If someone has a low opinion of themselves, they may translate this to not respecting the opinion of anyone who genuinely likes them, seeing it as a sign of your bad taste or stupidity, and gravitating to those that mistreat them, seeing it as a sign that the mistreater has accurately assessed them as deserving of poor treatment. They work to please the mistreater, as any sign that that person is impressed is taken seriously, while you liking them is seen as a sign that you are a dope and your opinion doesn't matter.
It isn't your fault, but do the healthy thing for yourself and avoid them if they treat you as if you don't matter, or you're being sucked into the same way of thinking.