How would unionizing help stop a company from setting up an offshore subsidiary? It may prevent layoffs in the short term - but even with big3 auto manufacturers it hasn’t prevented a move in manufacturing to Mexico and Canada.
I think the solution here has to come from the federal government to explicitly increase sw development employment in the US. Just like we find ourselves in a bad place with scaling chip manufacturing, we will find ourselves hamstrung in sw dev.
I doubt unions can help here - except maybe pressure the government (and that too works mostly on democrats if at all).