Evolution is another explanation for treating people as less than human. Traits propagate best in small groups, so a predilection for mating in such groups would itself be selected for. People outside one’s group would be less attractive, and if there was a limited common resource, considered a threat.
Communications and transportation technology, coupled with the cultural evolutionary tool of business, are turning the entire planet into a single community. As a result, xenophobia has become a hindrance, and arguably dangerous to the entire species.
To continue evolving, it may become necessary to intentionally fragment humanity, such as sending small groups to other planets. Fragmentation may happen unintentionally if our global economy cannot be sustained due to more expensive energy (oil depletion) and the rapid degradation of natural systems (so fast that technology cannot compensate).