Musk is falling for the libertarian misconception that globalism and free trade (including free migration) drive innovation. The rationale is that the most innovative people in the world can be brought together and put their collective talent towards a common goal. Much like how Musk moved from South Africa to America.
The problem is that these individuals (even the ones who actually are bright) have no common ethnic, national, or religious identity. So, their efforts are put into shallow material pursuits, not taking civilization to new heights. This is why the greatest minds of our time are wasted trying to get you to look at more ads on the internet.
In reality, it's not a vague notion of a universal humanity, but competition between nations which brings out the best in man. It wasn't a "global effort" which brought humanity to space and the moon, but the USA and USSR trying to outdo each other.
Musk will have to decide whether he wants to take humanity to Mars or support immigration. He can't have both.
https://twitter.com/elonmusk/status/1753847055749959765