We have the ability to change how we interpret and react to things. That allows us to control the harm we allow to ourselves from our interaction with others. Someone could be intentionally trying to harm us or we could be misinterpreting their intent but either way we have control over how we react.
As always this in easier said than done. It requires a certain level of detachment and awareness that can be hard to find in the moment. Like any other skill (and it is certainly a skill) it can be practiced and honed. Start with bringing awareness to the situations that aren’t charged and you’ll be prepared for the ones that are.
Nobody likes being harmed so it’s nice to know we can make a choice in the matter.