I’m not sure that’s true. Devs do well but not necessarily better than nurses, doctors, and engineers.
The big gap is in licensure and education. You can get a high paying job in tech starting with a GED if you play your cards right. That is because demand is so high, and the field has zero professional standards (in the sense of an actual profession with an actual organizing body, like nursing or medicine or engineering, etc.). The latter part is important. There may be lots of demand for nursing, etc., but real professional organizations do not lower their standards in order to accommodate demand.
Two things will happen this century. First, there will be many, many more people who know how to build basic systems (Web applications, etc.). Second, people will have a much better understanding of the risks involved in software development, which are now still mostly abstract to the public (but this is already changing). Once those risks become apparent, there will be an attendant demand for actual professionalization (standards bodies, licenses, codes of ethics, etc.). There will be greater regulation and classification of software development as a profession (i.e., you might not need a license for some kinds of work, but for other kinds, you will have strict licensing). This will drive up the compensation of (credentialed) developers to the level of doctors and engineers, but will also create many more barriers to entry in the process.