As recently as the Obama term the democrats were anti illegals. There are several montages out there. Why were they anti illegal? Because they hurt the unions. That was the one and only reason.
But then Trump started to flip the unions one after another. On top of that, the democrats were hemorrhaging voters. The democrat answer besides cheating was to pour people into cities and other areas such that they could leverage those numbers into redistricting.
The democrats have dumped most of the unions in favor of illegal numbers to give them more power. If illegals and other non citizens are not included in the census, their plan blows up. If Trump deports the illegals, TPS and refugees, their plan blows up. The democrats are all in on their illegals plan.
Also depends on the politician. I'm sure there were a few Democrats loyal to their local unions, like the so called Blue-Dog Democrats in the South and Midwestern Democrats, but by and large, ever since Reagan, the Democrats have effectively supported illegal immigration on a national basis regardless of their rhetoric. At the time, Reagan's amnesty was presented as a concession to Democrats to get cooporation on other issues, even though union Democrats said they didn't like it. Farther back I don't know.