First job out of school - low pay, worked in a crappy cube farm in an old building outside of a city center at an industrial park. Had to be there at 8 and stay til 5 no matter what. Middle management sucked. Pay raises were low. Health benefits were horrible. No vacation for a full year (yea I could've negotiated that, but why should that even be negotiable? absurd.)
Switched into software and never looked back. Better hours, better pay, better benefits. More respect for work life balance. Better office locations. Younger colleagues.
It's easy to see why people don't go into the sciences. The sciences are attacked on a daily basis in this country. From vaccines to global warming to covid19. The pay is low. Outside of engineering, the jobs suck, and you almost certainly need at least a masters. Academia is filled with tenured has-beens who exert undue influence over everyone.
The richest engineers I known became sales engineers. The ones who worked on problems were never rewarded for the problems they worked on - thus they instead went to selling and made boat loads instead. Who can blame them?
It's in my opinion more complicated:
My first point is that the metric that you are interested in is not maximum salary, but "salary minus costs of living". The highest paying job does not necessarily maximize this metric.
My second point is that companies that offer worse salaries (or are worse in the sense of the metric of the first point) have to compensate to stay attractive. Be it via better working environment (no open plan or cubicle farm), be it by offering really interesting work, etc. I consider this to be a feature.
Even after netting all that out, though, society often "commands" us to work at jobs that seem relatively useless. I suppose you could counter that "seeming useful" is itself a form of compensation. But still, it seems a bit dreary. I don't have any answers.
As far as non-monetary comp offered by companies (e.g., more interesting work), the problem is that it's really hard to tell whether such offers will actually pan out. It's very much luck of the draw whether you will get to do interesting work, or perhaps just end up sitting beside someone who is, while you are tasked with something meaningless. Been there. It's very difficult for companies to be credible on this.
I respect people who take low-paying jobs when they don't have to. In many ways, they're donating money to society, and that's pretty damn cool of them to be doing it.