You're trained in something because you love it. You really want to do it, and you went to school for it, have experience in it. Someone gives you a choice -- you can do this for $XX/year or you can starve. The labor market is not as "free" as free-marketers make it out to be. I made a mid-career switch from social work to coding in part because of compensation, but it wasn't a friction-free switch. Also, my point was in response to the above poster who claimed that engineers were getting a fraction of what they deserved. By your metric, programmers are also getting what the market values them at. But by OPs metrics, I maintain that teachers create a lot more value than someone building another ad-tracker.
If you're doing it because you love it, then you should consider that joy/satisfaction as part of the comp package. A lot (most?) high-paying jobs are high-paying because people don't love doing them and they involve a lot of sacrifice. That's why they call it 'compensation'.
Then maybe we should have a reverse auction for jobs? I can pretty much guarantee you'll need to pay more for someone to work in a mine than to push pencils in an office, for example.
But within the same skillset, the higher paying jobs are usually the crappier jobs (longer hours, more stress, more physical discomfort, less job security, seasonal, etc.)