Anger isn't what's being punished, choosing to act on it is. I've met people who think that racism is an act that people choose, instead of a natural feeling that you shouldn't act on. Tribalism, whatever it's about, isn't going to go away any time soon, so I think trying to make people feel like they're part of the same tribe is a better solution than trying to legislate away millennia of human nature.
I don't think anti-racist legislation (what even is that? Do you mean maybe civil rights acts type things?) Is trying to legislate away human nature. Near perfect empathy is also in human nature. After all, why are we capable of desiring to end racism? It's about choosing the ethical and good parts of our nature, promoting that, and making Hate the less desirable choice.