The problem is that a very large group of wealthy and influential people of all political leanings like the idea of having a pool of people that they can treat like peasants, serfs and slaves... .
Decades ago, when I was a carpenter, I used to work in Southern Arizona on housing developments. Since I spoke Spanish, I was often chatting with the Mexican workers. Their incentives were simply economic, and these people were in no ways 'enemies' of the USA. One guy was a registered nurse, educated and certified, but at the time, a framer on a production framing crew made many times more than a registered nurse in Mexico. These guys made money that they mostly sent home to their families, and when possible, they would go back across the border to be with their families, and then come back.
Calling these people 'enemies' as a justification for inhuman treatment fails on a couple of levels. First of all, the separation policy of Stephen Miller and Trump was simply immoral. Calling someone an 'enemy' justifies all kinds of treatment that would be immoral to any other group of people. So, by reframing the language, it became OK to do some pretty terrible things to a very poor and vulnerable group of people. In my view, that whole line of reasoning and action is immoral and unchristian, and really goes against much of what we think it it to be an American. There are some folks here who have defended it, and as far as I am concerned, they are defending the undefendable, even though they don't like being told that their morals may be askew.
There are better ways to handle this, from a more humane and economically sound perspective. The first thing is to arrest and imprison the CEOs, CFOs, and managers of corporations that hire illegal workers. That will constrain demand significantly, which will do the most to prevent illegal immigration. Second, we need to institute a seasonal worker program on a larger scale. If there are jobs that just cannot be filled by Americans in large enough numbers, then there needs to be a way for these people to come over, work for 6 months (or whatever), then return. With a legitimate way to cross over and work, all (or almost all) the traffic would be through legal channels where we could more easily monitor sex trafficking, contraband, etc. With them having temporary status, they could also avoid the kind of exploitation that leads to sex trafficking, blackmailing, etc. But most of all, for the US, it would mean allowing us to control all kinds of aspects of the migration pattern that currently we have no leverage over (we could do background checks, monitor employment patterns, collect taxes, etc.). It would eliminate the antagonistic relationship, with all the benefits that accrues with cooperation (e.g information on groups associated with terrorism who are trying to sneak across).
Now we would have to get to some consensus on what kind of work (e.g. relatively unskilled) work would be allowed, to prevent having any impact on American jobs. But there do seem to be some kinds of jobs Americans won't do - picking lettuce all day in the Arizona sun is a tough sell to a modern American.
The wall was never going to work because it is a simple, dumb solution to a complex problem. But it appealed to folks who are looking for a simple answer. Unfortunately, reality is not simple. To change behavior, you need to incorporate the economic perspective of incentives. Humans are very much economic animals with sophisticated behaviors, and problem-solving is often difficult.