Imagine if you make airplane engines for GE as an ME, and you want a higher salary, who else are you going to go to? There's barely any companies in the country that have the capacity to make airplane engines, so there's less competition for your labor. Your work is probably fairly specialized to, so if you transfered into some other engineering domain, you'd start at entry level salary.
Now look at a software engineer working for google, if he wants more there's a dozen companies, in silicon valley, FAANG, wall street that will take his services, he and a few friends can even start their own thing with their laptops and a garage. And skills transfer relatively well between different software engineering jobs.
Because software as low entry to barrier and many employers and non specialized skillset, the competent generalist has massive leverage in the labor market. Mr PhD in electric optics, has 3 employers in the country that can give an opportunity to actually use his degree.