This is true
If we, and other developed Western nations, invested in stable governments and promoted businesses/manufacturing in those countries, we could divest ourselves of Chinese influence, have inexpensive labor for products and eliminate the conditions that create these mass-migrations.
But that would require money and long-term policies in place, with the assistance of free market businesses. Something that most businesses that focus only on quarterly returns just aren't interested in.
I would love to move manufacturing from China (who hates us) to Mexico, Guatemala, Honduras, El Salvador, etc. As you indicated, we just gotta make sure we can trust their governments.
There was a recent report that China was exporting ingredients that are used in the production of fentanyl to the drug cartels in Mexico. That fentanyl, of course, then enters the United States, killing Americans.
China is our enemy. Plain and simple.