Work that people enjoy more probably pays less because people enjoy it more. It's supply and demand: there's a greater supply of labor for jobs that people want to work at. Most people consider having a nice work environment to be worth $X to them, so their indifference curves get shifted over.
Yes, economists these days don't talk about compensation so much but "utility" which is the aggregate of salary, cow-orkers, short commute, nice office, meaningful work, yadda yadda. People will always act to maximize utility.