A countries’ development is merely a spectrum. That developmental spectrum can follow the developmental stages of other countries or the developing country can leapfrog based on 1. Its understanding of how other countries developed; 2. Its own unique dynamics and/or 3. Technological advances. As countries become more developed, there is less of a need to move to relatively more developed countries to improve standards of living which naturally slows immigration flows and is the built-in mechanism of shared prosperity.
Immigration comes in two forms usually: 1. Moving from relatively less developed to more developed and 2. Forced displacement (similar to Archimedes but not a Eureka moment) via natural disasters/war (in all of its forms). The forced displacement exacerbates natural immigration flows. Absent point 2 and in conjunction with point 1, when other countries become wealthier (people), the natural byproduct is less of a need to immigrate to wealthier countries and less of a need for borders, if at all.
GDP per capita is a poor measure of wealth as it does not take into account the net equity position or the distribution of the net equity position. Moreover, income inequality exacerbates stresses in the economic system. The combination of forced displacement coupled with the stresses from income inequality exacerbate prejudices against immigrants/migrants which is unacceptable. Even in the United States, most people are poor on a net-equity basis. Trickle-down economics seldom works due to misappropriation of funds, whereas trickle-up economics does work, although trickle-up is a misnomer.