This kind of migrations were non preventable before but now we have enough resources and technology to build walls and surveillance to block them entirely.
Unfortunately, the only thing that is missing is will to do so.
At some point, the numbers of migrants will overwhelm any technology to detain them. The only option then will be to kill them. The will to commit mass murder will be harder to muster than the will to build a wall.
I'd be even more worried about a coming war. Latin America might not be able to mount a direct challenge to the United States, but an outside power could easily offer them a better deal than eternal poverty to take up arms for their side. Heck, the narcos are already well trained and equipped.
Climate change is a problem we can only build ourselves out of. Whether that's technology to eliminate CO2, or society building to create more stable power structures. (granted, there are some very cruel stable power structures).
The rich nations won't any longer be able to validly accuse the migrants of "not solving their own problems", since we caused it. The choices are genocide or building, and nations do behave wisely once they have exhausted all other alternatives.
Unfortunately, the only thing that is missing is will to do so.