Unions work in physical domains that need labor “here and now”, think plumbers, electricians, and the like. You can’t send that labor overseas, and the union can control attempts at subversion via labor force importation. But even that has limitations, e.g. union factory workers simply having their factory shipped overseas.
Software development at its core can be done anywhere, anytime. Unionization would crank the offshoring that already happens into overdrive.