It hurts whenever I open up to someone and am rejected. That's why I prefer not to open up to anyone in RL.

And that's kind of where I've been leaning lately, but I would be lying to myself if I said that I don't have needs for relationships.
Rarely anyone presents as a "pure" form of any disorder, but often are diagnosed with several, or have traits of several disorders. I've been diagnosed with many disorders over the years. MDD, BPD, AsPD (which was crap), social phobia, agoraphobia, C-PTSD, HPD, AvPD...
But over the last year and a half talking with my current therapist, I've come to realize that my core disorder is AvPD.
And I think that's kind of where you have to look. For me, I've always longed to be part of some group, to be accepted and liked. And because of constant rejection both at home and in my own peer groups, I just became what everyone wanted me to be. I never got to be myself and be accepted for me.
So I usually would go one of two routes to cope with rejection. One, I'd become VERY appeasing and chamelionic and could never be assertive, all to be accepted (read: crowd follower).
Or, I would completely withdraw and isolate from others and disconnect.
Rejection always hurt regardless. But if I have no desire to connect to someone, then I just don't care.
I am extremely tired so I hope what I said makes sense and gives you an idea.