Do not allow anyone to treat you as if they are doing you a favor by allowing you to be in their presence.
They need you just as much as you need them (maybe not, but make this your mindset and you’ll be surprised how much it becomes truer and truer). The less you need other people, the more they will respect you, because they know that you’ll be just fine without them.
This doesn’t mean you become some narcissistic asshole — that will repel people and leave you more alone than independent, if that makes sense (if it doesn’t, read the sentence over and over until you get it). Just understand that your presence has value and demand to be treated as such.
You have to decide what your standards of conduct are, and what standards of conduct you will accept from others. And give others no choice but to respect those standards.