It's a Darwinian world
Nepotism and favoritism exist because they are survival traits that maximize the reproduction of the members of that "in" group be it: family, clan, tribe, ethnic group, or race.
Doing anything "for the good of humanity" is a total waste of resources; unless it also directly benefits your group. In fact, doing things for the good of humanity can in many cases be ethically, morally, and legally wrong.