There's no straightforward fix because this behavior is something that emerges from mass psychology, like war. In a sense this is war, with new platforms to amplify and direct weaponized ideas.
If war is politics by other means (Clausewitz), we can turn that around and say that politics is war by other means. See: the Russian concept of hybrid warfare.
What ends war is when enough people in a society are convinced it's not worth it. And that happens when enough people are exposed to the horrors of war, when they see what it does to their own lives and to the lives of people they care about.
Now we're in a period when most people haven't been exposed to that level, so this is unfortunately an upswing.
The way through is for some number of us to keep our humanity toward others (in the positive sense), to act accordingly, to carry that through until conflict blows over, and to rebuild society afterwards.