I think it's structural. Salaries between EE and CS sharply diverged decades ago, and I don't think they'll ever meet again.
The finances on pure software are just so much better. Better margins, better scale, better return on equity. Since ROE is always going to be better (because you're not touching atoms) you'll always have better valuation on the stock market, and be able to pay programmers better.
It's less a "gap" in the market and more "the market functioning correctly". There's no law of the universe that says programming a robot has to pay as well as programming a SAAS webapp.
Think about scale. If you teach programming at a middle school, you have maybe 100 customers at a time. If you work for a hardware company, you have 1,000,000 customers. If you work for facebook, you have 3,000,000,000 customers. Which one of these will pay the most?