I hear what you are saying. My wife deserves a medal for the things she puts up with!
I know when I am feeling vunerable, angry or otherwise under stress I tend to push my wife away. I think for me it is a form of self preservation. I know that I am feeling as though no one could possible love me or no one will be able to put up with me so I better push everyone away before they push me away. That way I stay in control. And its that control that I think drives everything.
Usually when things around me are not going well or I am overwhelmed, I get stressed, really stressed. That stress leads to a feeling of loss of control, and I tend to micromanage in ever diminishing circles. If I cannot control the world, or things in my world, I need to control things closer to home. So I try to control those around me, relationships, my personal space. That usually leads to those around me getting annoyed with me, as I become needy. I then feed off that thinking that I need to control their reactions, and if they are going to get upset with me then I am going to push them away before they push me away.
Having written that down, it sounds so stupid, yet I do this on almost a daily basis. Fortunately for me, my wife understands me, and to a large extent just goes along with it. For me, I seem unable to stop it from happening, even being aware of what I am doing, yet I am so scared of being left alone or being abandon that I must push the other person away before they push me away.
I have not figured out how to stop it, nor how to control it, but I do know that my wife loves me despite of it. I guess that is what loving someone warts and all is all about.
Hang in there, give yourself a break, and remember to show your appreciation to your partner when you feel you can. hugs