Letting in all willing immigrants doesn’t really make sense in context of a Western welfare state. Migrants simply need sufficient educational background to find a job, without one they are just more burden to the public sector. So it’s not always about racism or classism.
It doesn’t have to always be about either issue for the core reasoning of the way the laws are laid out to be classist and racist.