It's also how humans work, and it is worth bearing in mind in discussions like these that our entire recorded history has yet to recount any evolutionary meaningful period of time. Confusing how humans in modern society ideally should work, with how humans actually do work, leads nowhere productive that I've ever seen.
It's not, it's a detrimental evolutionary holdover we should (attempt to) train ourselves to ignore.
Much like the behaviors that lead to obesity.
Perhaps one day, too, there will exist a human or posthuman being of sufficient perceptive, cognitive, and mnemonic capacity to understand how our species and our societies work in sufficient detail and completeness to usefully contemplate its directed modification. That day also has yet to come, and judging by the results of those attempts at social engineering our histories document, I'd have to say that to suggest any such course of action is, in the most charitable interpretation, an expression of optimism very far beyond the possible.
Until such a day arrives - and I suspect we'll know it when it does - I might make so bold as to opine that a much more productive avenue for our efforts would instead be to perceive and understand how our species and our societies actually do work, with an eye toward optimizing our own behavior toward whatever goal we find best suits us, while not making ourselves so intolerable to our fellows that opprobrium becomes condign.
Granted, this requires not only humility but the total abandonment of faith in human perfectibility and all other such nonsense beliefs - neither of which changes is terribly palatable at first blush. I have, though, in my experiments thus far toward modeling my own behavior after this apparently heterodox ideal, observed the results to be quite strongly beneficial in my own case, and to the limit of my perceptual ability, in the cases of those who regularly interact with me as well. Perhaps others might observe a similar result.
At its core, it is precisely the Christian doctrine of the new life in the world to come, only with the serial numbers filed off, and God and the eschaton elided from the picture. As such, it makes no bloody sense whatsoever, but still has a strong appeal for Unitarians and others uncomfortable with religion and thus unavailing of the Christian utopianism of which "human perfectibility" is a corruption.
But again, a "signal" with a high false-positive rate (eg, most people not wearing shoes pose no threat) and false-negative rate (eg, most criminals, especially the dangerous ones wear shoes) is not a good or meaningful signal. You can't make reliable predictions of danger from it, while attempting to distracts from more useful signals and gives us false confidence.
So not only does it not reveal danger, it gives us false confidence we can reliably detect danger, making us more vulnerable to real danger (eg, serial killers).
The instinct was likely useful as primitive humans (eg, preferring our species or pack to other species or packs), but likely is a detriment in modern society.