"The ideal degree if you want to hire someone" is different from "the ideal degree if you want a high salary".
To get a high salary, you need to be in a good negotiating position, such that if company X won't hire you for US$150,000(/year), then company Y will hire you for US$145,000 (a strong BATNA). There are three possible reasons company Y might not hire you for US$145,000:
1. They are badly managed and making irrational decisions.
2. It would be unprofitable for them to hire someone like you for US$145,000; in an engineering position, this is because their revenues minus cost of sales would go up by less than US$145,000, risk-adjusted.
3. They can hire someone else like you for a lower cost, such as US$130,000.
Item #1 can mostly be discounted as a difference across fields; there are badly managed companies in every field, but generally they aren't the ones who hire a lot of people, and they aren't the ones providing your BATNA. However, in the case of programming, company Y might be you and your college roommate setting up Pinboard or Tarsnap, so there is perhaps a relevant difference here.
A thing about items #2 and #3 is that "someone like you" means "like you" from the company's perspective before they hire you. The fact that you can solve hard leetcode puzzles during the interview in ten minutes figures into this, because that's something they can observe before they hire you, unless they go through a recruiter, in which case it doesn't. If you can do a board layout with 166 MHz DDR and it will work right on the first spin with no signal integrity issues, that doesn't figure into "like you", because that takes at least a week, so you can't do it as part of the interviewing process.
The bigger difference, though, about item #2, is that the returns to NRE work in either EE or programming depends on volume. If your EE innovations give them a working board that costs $3.80 to produce instead of the other guy's $4.30, then if they're producing 100 units, you've produced $50 of value for the company. But if they're producing 100,000 units, that same amount of work on your part has produced $50,000. And similarly if the product brings an $0.50 higher price instead of having an $0.50 lower cost. And similarly if we're talking about lowering the cost per user of operating a server farm, or increasing the ad spend per user.
So why is that a difference if they're both NRE work? Because producing 100,000 units of an electronic device requires a huge amount of up-front capital investment. You can't produce 10 units one day, then 15 units the next day, then 25 units the day after that. So if Company X is investing $3 million in your project and Company Y is investing $0.3 million, the Company X devices are likely going to get produced in ten times higher volume, so every design decision you make is worth ten times as much money.
Now, of course if you're working on Google's backend systems that serve, ultimately, 5 billion people, an 0.1% improvement produces more value than an 0.1% improvement in the systems of a company with only 1 million clients. So FAANG can afford to pay hackers more than the average health plan, ISP, or venture-funded satellite imagery startup. But, even in those cases, the capital investment needed to get a lot of value out of a programmer's work is fairly small, maybe US$10k to US$100k, rather than the US$1M or more that is common for EE projects. This puts programmers in a much better negotiating position.
So, though the two fields have similar diversity of applications, type of work, and intellectual difficulty, electrical and electronic engineers are reduced to begging for scraps from rich employers and then have to sit in bunny suits on factory floors with shitty coffee, while programmers get free massages, incentive stock options, and private offices. Except in countries where companies hire programmers through recruiters.
(Why do they do that? I think it's mostly an industrywide case of #1: companies in England and Australia use recruiters because everybody else uses recruiters, and so the ambitious programmers leave the country, reducing the large advantages obtainable by black-sheep companies who hired directly and could thus hire only competent programmers, to whom they could profitably offer twice as much money. But maybe there are legal reasons or something.)