There's another thing. Nationalism/Patriotism is
important. They are concepts built around groups of culture and socialization. Is culture important to you? It certainly is to a lot of people, most especially the people who are all for 'equal rights for everyone but maintaining our cultural differences/uniqueness'. I agree that nationalism can go way too far, but for the most part, it's based on a community's shared ideals. Those form the culture of a nation, which ideally can socialize the entire nation with the same moral system. Join, or die, as they say. A nation doesn't work very well if it's fragmented. In order to have a community (and humans are community driven creatures), I think there needs to be unity of culture, or at least socialization. At this point, we as a human race are not ready for ONE GLOBAL NATION. Until then, I think its reasonable for a community (in this case a nation) to prioritize members of the in-group to members of the out-group, because the in-group is socialized to truly be part of the nation. Just like how any individual human will prioritize their family OVER most any other human being, even though we are all equal. A nation is a form of community, and not just an arbitrary notion.
Since there are limits to resources in any nation, there need to be limits to population flows between nations. Moreover, in order to maintain the unity of a nation community, any individual aiming to enter needs to be willing to be socialized into that nation; including but not limited to the main language spoken, norms and mores (basically cultural and moral standards), the education system, that nation's shared heritage, and the governmental system. All of that should be involved in picking a place to live; which is why moving to another socialization system should undergo a rigorous citizenship process.