To me, the key is always good-faith.
Abso-frigging-lutely. Even the dumbest person, or maybe someone with a bad memory, but who is trying can eventually be trained, or else constrained, whereas a malicious actor can do everything "right", until they get what they wanted all along and then cause the highest magnitude of harm.
I like how you are approaching it intentionally, which demonstrates awareness and intent to make things better for yourself, and also others as you plan ahead for what is most important.
Then this might help: remember that even as you try to set boundaries between yourself and others, you can set boundaries within yourself as well. e.g., you could watch a movie depicting a fictional narrative of a not-good-faith event, and decide to at least attempt to not be triggered, or at least quite as much. You cannot control the world, but you control your response to it, and you deserve to be happy:-). Though you need to find the route to get to it - even in spite of others attempting to ruin it for everyone around them, to become as unhappy as they are.:-(
I guess you already said this, sorta, in that when people act that way, you respond to increase your happiness by getting away from that source of toxicity. But I mean something deeper, which you may also already be doing, in terms of setting the boundaries within yourself, to not feel unhappiness about their actions.