An example. Israel shocked everyone several years ago by building a wall between Palestinian and Israeli neighbourhoods. Many mocked the wall as it was being built and others said it was an affront to the relationship between Israelis and Palestinians.
The wall had the effect of forcing people through legal checkpoints if they wished to work. In turn, this reduced the volume of terrorism by Palestinians of the Israeli people during the second Intifada. It also split neighbours from one another.
Costs and benefits. A wall does something. It changes the environment. So we shouldn't diminish a wall's potential for making an impact.
In the US-Mexico case, I doubt the value. But it may have one all the same.