It's a bit trite but this Venn diagram (perhaps inaccurately) labeled "ikigai" I think does a pretty good job of teasing apart exactly what you're talking about:
https://performanceexcellencenetwork.org/wp-content/uploads/...
Jobs are a combination of:
1. How much you enjoy the work
2. How good you are at it
3. How much it benefits the world
4. How well it pays
The ideal job will tap all four but those are rare. Most jobs are some mixture. Shit jobs tend to only do one or two.
I think what you're talking about is #3 which I think a lot of people undervalue in our culture today.