Exclusion seems to me to be a very natural human tendency.
Richard Beck, in his book Unclean gives at least some reasons for this, though it’s not comprehensive. The main issue he sees is that we tend to mix physical disgust (the trait the helps us retain physical boundaries and keep us safe) with how we think of other human beings. The famous example he uses is the Dixie cup/saliva experiment, where subjects were asked to spit in a Dixie cup, and then were asked to ingest the spit. For complex protective reasons, the body immediately becomes disgusted with the thought of reincorporating our own saliva after it has been expelled.
Another great example is the simple question of how much fecal matter would it take to be mixed into a batch of brownies before you wouldn’t eat them. The answer, for nearly everyone, is a whopping “anything more than 0%.” In other words, even the smallest amount of contamination has the potential to “turn on” our disgust mechanism and reject the whole thing.
Both of these are telling experiments for normal human psychological traits. When we expel something inwards, we cannot help but see that thing as “other.” It has crossed the psychological boundary that we’ve created in our minds about what is “in” and what is “out.” Also, we have a tendency to think that even the smallest contaminant has the potential to ruin whatever it comes into contact with.
The danger of these two psychological traits is not that they are inherently bad. These two traits keep us physically safe and healthy. The danger is that we have a tendency to allow these disgust impulses to bleed into our social, emotional, and religious lives. Allowing disgust to dictate how we build communities, maintain relationships, and reflect on God and the divine carries enormous consequences. It can lead us to the dehumanization of those who are different from us, the building of exclusive communities built on distrust of the other, and the propping up of unjust systems that marginalize and disenfranchise groups.