Overcoming the Fear of Rejection
The difference between phobia and 'the butterflies'
Whatever happened, that feeling that you're deliberately doing things to elicit rejection, usually does come from anger turned inward--the "I'm gonna eat some worms" syndrome, I call it. (Some of us are old enough to remember the perverse little ditty that went like this: "Nobody loves me everybody hates me, I'm gonna eat some worms.") There's a perverse sort of satisfaction in doing this that's hard to describe, but if this is what's driving you, you'll recognize it.
You may need to have a heart to heart with the person who's hurt you, asking what that was about, expressing your discomfort, etc.; this often enough will take the sting out of the situation and neutralize the embarrassment, because you're taking charge of your reaction. You may hear some things--about something you did, or that was perceived you did, that will surprise you. If so, try to listen non-defensively. This is a good conversation to be having. Pay attention and listen well. Maybe you'll want to change some things. Mostly, you just want to disrupt the cycle that's getting you deeper into the muck.
You may want to confide in the most trustworthy person you know and get some support from outside yourself--someone who can non-verbally cue you and support you in some of these situations. And finally, sometimes just acknowledging to yourself that you're angry, resentful, and hurt can stop the behaviors that are inviting rejection.
Anyway, I hope something here fits. Let me know how it's going.