I give you an example for this:
Your psycho father always told you that you are a bad child / person. Said it, acted like that, manipulated you to think that, etc.. You left your parents house, not knowing that your father was a psycho, and that he INTENTIONALLY did this to you, without ANY REASONABLE act from your part (in reality, psychos usually tell you things they KNOW aren't true, because thatis what hurts people the most). So the situation is NOT resolved, not understood. So, as a result your sense of self (your idea about who you are as a person), left "open" at that portion. You, based on your logic, your own judgment, are NOT a bad person. BUT you still have all these memories and associated feelings from your childhood, where your father told you you WERE a bad person.
This is a cognitive dissonance, and it is unresolved. So your sense of selfe is ruptured.
And everytime in the future, when someone tells you that "You are a bad person!" (not literally, but as the main message), or you are in a situation where the other person implies that you are a bad person, you get ENMESHED. Which means, you are not sure whether you are REALLY a bad person, or the other person is just lying, or blaming you for his/her own fault, etc.. Your emotions that are coming from the past just confuse you even more, not letting your "logical mind" see the situation for what it is. Painful past emotions saturate and distort your judgement.
So, the "boundary" between you and the other person blurs. "Is this strong emotion in me is HIS fault, or is it MY conscience?"
And you probably, unconsciously gravitate yourself towards those people, because you deep down want to resolve the question.