Do you have actual examples of irrelevant jobs in software engineering that have been kept on because of unions? How about unions advocating for proprietary software in order to keep out open source software?
Given that many software unions already exist, the burden of proof is on you to prove that such things are actually happening. It's unreasonable to expect someone to prove the negative here.
If union members benefited from automation, they'd be all for it. Why should someone be for a change that makes them jobless? Corporations certainly don't lobby for changes that decrease their profits.
This is like when the Luddites were labeled anti progress, when in reality they we're anti being replaced and left to starve in the streets, with the industrial automation being the linchpin in a set of events that caused said starvation.
Share the wealth or don't be surprised when people will fight you over it.
Think of all the job descriptions that have become irrelevant, for most startups, in the last decade: "DBA", "sysadmin", "IT". Even in the past year or two, thanks to docker, there's less need for "devops".
Unions exist to protect the interests of today's--not tomorrow's--workforce.
So yes, I certainly believe that a union would say "companies that use docker hire 90% fewer sysadmins than those that do not. We have 70,000 members with that job description. The next collective bargaining agreement will forbid it.
Labor unions have historically been anti automation. If you think software unions are somehow different then the burden of proof is on you.
Imagine that 10 years from now someone invents an AI that can magically take a set of plain english specifications and output a working, high-quality CRUD web app, making a single engineer as efficient as 10. Do you think the software engineers union at BigEnterpriseCo would let them use it?