When people come to me, upset by an interaction with another, I often ask them, "Whose problem is it?" Many people assume that if someone is mistreating them,they must be doing something to deserve it. "If the boss yells at me, I must have screwed up." "If my partner rejects me I must have done something wrong." "If someone cuts me off in traffic I must have been driving too slowly."
There are three things wrong with that thinking.
First, no one deserves to be mistreated. Even if you have made an innocent mistake, you don't deserve to be mistreated. And what if you did provoke it? You may be acting like a jerk, but retaliating against you doesn't make the other person right. It just means you are both behaving badly.
Second, some people are ugly to you for reasons that have nothing to do with you. I once worked with a colleague who would blow up at clients constantly. Her wrath originated at home, but she took it out on the clients. After being lamblasted by her, a client would come to me completely crushed or ready to fight. But when I asked them to step back and observe her behavior, they found that she blew up at people all the time - innocent people. Once they saw that it happened to other people, it was clear where the problem was.
Third, people sometimes behave badly because of what you are doing, but what you are doing is healthy and appropriate. For example, you try to set a boundary with a narcissist and they rage back at you, then project their anger onto you and accuse you of being the angry one. This can be a really wild ride if you have trouble hanging onto your sense of self. But that is their unhealthiness, not yours. (It's probably why you needed to set a boundary, too!)
The next time you have an altercation with someone, take a step back and ask yourself, "Whose problem is this?" If it's yours, take responsibility and make it right. If it's theirs, take a deep breath and walk away leaving the problem where it belongs - with them.