I've long said that if the way someone's behaving doesn't make sense, you don't understand their motivations.
Now, it may be that their motivations are all messed up and they're acting the way they are because sabotaging their relationships reaffirms their core belief that they're unlovable. But it does make sense once you understand the framework they're working in.