It may also be that your old friend is feeling pretty unattractive and scared and depressed. One way for him to manage all those difficult emotions may be to fantasize something romantic being kindled between the two of you. That may help him but it will threaten his wife and make life difficult for you. He’s too self-involved right now to take other people’s feelings into consideration so he may well be oblivious to how you and his wife are feeling.
I have a guess that you are feeling in a bind. You don’t want to be unkind but the situation has become more complicated and emotionally charged than you signed on for. You may be worried that if you distance yourself, this man will feel even worse about himself. If you don’t, his wife may read more into it than you intend and he may think you’re interested in an affair.
You were right to be clear with his wife and to connect with her as well as with him. If you have the time and energy to be friends with the couple, you could be an important support to both. I do suggest that you see them together until this gentleman understands that you are not girlfriend material. If you can’t handle dealing with both his condition and his unrealistic expectations, then the kindest thing to do would be to tell him that he has the wrong idea and that you can’t offer him the distraction of flirtation and romantic possibilities. You could tell him that you are flattered but since you are unwilling to be “the other woman,” you need to step away. Offer him your best wishes for regaining his health and say goodbye. If that’s your choice, you don’t need to feel guilty. He was the one that made the situation untenable, not you.
I do appreciate how hard this is. You had nothing but good intentions. But sometimes we find ourselves over our heads. In my opinion, it’s better to recognize it and do something about it than to allow yourself to be swept up into the situation and to inadvertently lead the old boyfriend on.
I wish you well.