Here is how thats conceptualized in my mind.
The law is a story until it is enforced. If you enforce stuff, and how stringently, is often political. And law (some of it) changes over time.
This does not concern matters of life and death or highly amoral crimes, or crimes that inflict acute suffering on parts of victims - we don't talk about those. For those I'm almost in line with your point of view.
But then you have to notice one thing. If you play Joe Arpaio - on every single issue, costs explode, and to compensate you might end up with economies in prison populations, that now develop a draw for more intake - which weighs on the way law is enacted. This is a worst case scenario, bust just think it through theoretically.
If you fly or drive all of the people back you have a cost issue that you actually cant bare (they have to be legally deported, which means legal costs, enforcement costs, ...), and you'd have a political issue on your hands on top of that - keeping people alive at a base level is actually not that costly - even for years.
If you just refuse them entry - and would really produce a "fenced out scenario" - the amounts of issues you'd have at that border, from people not shrugging their shoulders and going back into the dessert are homogeneous. If tragedies start to happen there - and they are documented, and they are widely acknowledged. You'd have populations in the street trying to stop those, just because people don't want to loose their humanity in looking at it and doing nothing.
So what you do instead - basically is to work with the source countries (if they are stable enough), and you play "theatre" for the media. (Deport 2000 illegal immigrants in consolidated action). That theatre has a very real effect, as it reduces the influx.
So - in some sense, the real "barrier" to enter society always is "how to become a legal citizen" - the rest is often inaction, because actually doing something would be more costly. So high concept moral standards dont count for much there. You will never send people back into a dessert in masses. You just wont.
You might help build up a certain region where large parts of them are from, and keep their living conditions low - so some of them actually might want to go back - when they start to see that as a viable option.
This usually is most cost effective.
Making people want to do it on their own. You might bribe transition countries, not to let them through on their way in. In europe we even pay immigrants to go back in many instances. Give them starting capital, so they can tell their "adventure story" in their home countries, and tell them that its not so bad there, and even have higher social status, because - they could now buy a shop from european state money (which is worth more there). And the effort is mostly PR, and driven by cost analysis.
So in a sense what I'm saying is - that calling them illegals (which we do), and equate illegal with bad - doesnt accomplish anything towards solving the issue. And even if you call them bad your whole life, because they are illegals - you still will never force them back into desserts, you just wont.
But then also - you will want to give them lower status and call them illegals, if you want them to grab onto opportunities to leave.
Its entirely improbable to even let a tenth of them see a court house from within - at which point you might have to look at forms of living without rule of state law (camps, slums (gang issues)) - which all is a factor of numbers, social care and opportunities. But you still will never just send them back into the dessert.
So its most easy to not let those situations develop in the first place - which is why half of europe is so hyped up on the climate issue currently. (Its cheaper to deal with it through "foreign aid" and "millitary assistance". But both of those can go wrong as well.)
(A 'america first' policy with states on your southern border, actually hightens the issue - that also something you could look into. Populists might actually be interested in it continuing to stay as an issue of daily importance - at least when voting season comes along.
'America first' in international trade deals is something else that doesnt necessarily follow that logic. You have a responsibility for the political and economical state of the countries bordering you, is what I am saying.)