In Mexico's case there is is a lot going on. You have a highly corrupt government, lots of slave wages, powerful and violent cartels, and thugs all over the place. If your place was stuff and beyond repair, you'd probably go to the next country over as well for a better life.
In addition to that immigrants are always exploited. Out along the border you have people who claim to know the land pretty well and can guide them safely through it for a small fee. However these people quickly find out their guide is just a robbery who robs them and leaves them to die out in the desert. The alternative is that these groups get picked up by the cartels and basically becomes slaves or they are trafficked into the US by the cartels where their fates are unknown. You also have the big corporate farms using them as cheap labor, basically some really repetitive manual labor jobs that none of us would want to do.
Just giving them citizenship would just be sweeping the problem under the rug, just look at the language and culture barrier. If we just built a wall, then we would be turning our backs to the problem. Plus people just try to find a way around it, under it, or over it, and possibly through it.
I think the answer to the problem is to try and improve the situation in Mexico. Basically eliminate reasons to cross the border.