One perspective on this comes from game theory and the Iterated Prisoner's Dilemma. In some cases the optimal strategy is "tit-for-tat". If your opponent defects and sells you out, then the best strategy for the next round is to retaliate and defect in response. [0]
Obviously this is simplified, but it shows how a mechanism for identifying opposition could be advantageous. In the social environment of early humans, maybe this made sense evolutionarily, but is now inconvenient in the different situations in which most people live now.
[0] https://en.wikipedia.org/wiki/Prisoner's_dilemma#The_iterate...