The situation is complicated. An "Immigrant" status is like "foreign student" status in some ways. They come here "by hook or by crook" and immediately, they start to learn American ways and know-how. Above all, they are acquiring skills they likely would not have available to learn wherever they are coming from.
Now, investors of the West, including venture capitalists, are not likely to invest their monies to establish businesses that work with companies in advanced nations if the labor market of some foreign country they are thinking to invest in are not trained--not trained in computer usage, for example. You say, the governments of these countries should educate their kids and young adults even mid-life laborers in modern technologies. But in some countries, there's little emphasis on gaining book and trade knowledge; and so individuals educated on home soil are unable to benefit from their personal educative experience in their years of schooling to contemporary technologies.
However, there's a huge population in the world that are willing to "pick up and leave" for a time (unspecified length) and journey all the way to the United States. To turn them away, is to reject them, in some profound sense, from the technological revolution, which has occurred only in the last 1 and a half Centuries-not a long time for the world to catch up.
But business and the move of time--right-into-the-future--can't wait. These laborers need to learn the skills of modern business and industry so that they can be of use in business and industry now. But investors are reluctant to put up the cash to provide enterprises, even governmental businesses, in order to take advantage of worker eagerness to participate that pay a living wage.
That's why advanced nations, the United States, have made it possible for the Chinese, coming here as students, and immigrants, including at the southern border of the country, to stay here and learn, and possibly, stay on to work for years to come. Those that become trained and want to go elsewhere, do so. Those immigrants, who, having been trained in technology, etc. may earn the privilege to live here.
Importantly, immigration status in the United States or foreign student status enables the individual so designated to learn modern techniques and become part of the new, revolution in knowledge and living the West offers through its educative systems.
My cursory explanation.