No it wasn't.
The total number of illegal immigrants in the nation had gone DOWN since Obama came into office, meaning that the net illegal immigration was negative. And the vast majority of Trump voters ain't got a life with any significant number of immigrants in it anyway.
Railing on immigrants is just dog-whistle politics for people butthurt about not having an all-White society anymore, along with a nice excuse for those who lose their jobs to be able to blame something other than their own skills or the corporations themselves for that.
If various people butthurt about economic problems and White nationalism didn't have (declining) immigration to complain about, they would have found something else easily.