I think the whole sentence is a bad take. The described behavior can be perfectly rational (and thus commonly considered not "stupid") in the case when cost function of the acting person has a negative weight assigned to the counterpart group/person. In other words, when someone considers the other an "enemy", it makes sense to hurt the other even such act results in some direct losses.
Now, we can argue that playing negative-sum games is "stupid". And in most contexts of the modern human society such heuristic would be correct, but I would be really careful with a sweeping generalization, otherwise instead of a proper understanding of the underlying behavioral motivations you are likely to devolve into primitive explanations of someone being "stupid" or even "evil".
Hurting the enemy is intentional and thus has an implicit "gain" built into it, even if it's just psychological. The physical losses can be deemed acceptable because of it, if the satisfaction derived from hurting the enemy balances them out. The OP is describing stupidity where the result is a true loss or zero gain, because the intent wasn't to hurt in the first place.
I suspect there's a strong correlation between people who are motivated by harming others, especially organised hatred of specific groups, and people who self-harm through poor modelling of consequences.
Harming others correlates with personality disorders. Personality disorders - especially Cluster B - correlate with poor impulse control, an emotional rather than a rational orientation, addictions, unreliability and dishonesty, and general inconsistency.
Disordered people with high IQ and EQ tend to get away with disordered relationships for longer. But it's rare to live one of these lives with zero consequences. So these types are at least as likely to go through catastrophic collapse as to get away with their chaos and dysfunction.
Now, we can argue that playing negative-sum games is "stupid". And in most contexts of the modern human society such heuristic would be correct, but I would be really careful with a sweeping generalization, otherwise instead of a proper understanding of the underlying behavioral motivations you are likely to devolve into primitive explanations of someone being "stupid" or even "evil".