No need to build a wall.
Winston Churchill said that socialists need walls to hold people in. (my words, such as East Berlin) Capitalists need walls to keep people out. (my words, such as the US)
Solution: turn Mexico from socialism to capitalism. The US is already going from capitalism to socialism. At some point, people will stop coming north and start going south. (oddly, beach front property in southern California will again be affordable. Property in Baha California will be outrageous.)
To be sure, there is one problem with this approach. Getting the US to become socialist seems to be simple. Getting Mexico to become capitalist is likely a tad bit more difficult than impossible. It just might be easier to build the wall, though I’m not sure.