The "Remain in Mexico" policy was not a deterrent because the people who were forced to wait out their asylum proceedings in Mexico did not stay there and illegally entered America instead.
There is no enforcement measure (short of shooting on sight) that will stop this from happening.
The only way to stop illegal immigration and to stop people from "gaming" the asylum process is to make it easier to come here legally. Period!