That is definitely a problematic situation that needs solutions like more legal immigration like you said, with better integration of new immigrants into society. Imagine a situation though where it’s basically the same except the child can also get deported and has limited rights and will now have immense difficulties becoming a proper citizen in any country, where their family continues trying to stay in the country via loopholes.
I guess I shouldn’t say “tends to” be like this, only as far as what I’ve studied.