This has been well studied. The answer is that compensation is proportional to marginal productivity rather than mean productivity.
I.e., consider a very important profession, say superhero. Having one superhero to stop the Joker is worth $1M. Having two superheros is worth $1.1M - Batman is sufficient to stop the very dangerous Joker, but two superheros can stop both the Joker and the far less dangerous Harleyquinn. The marginal productivity of an extra superhero is $100k even if the mean productivity is $550k. As a result, superheros get paid $100k because if any superhero quits, society loses only $100k rather than $550k.
An extra banker produces a lot of value. An extra teacher produces very little. Hence, teacher pay is lower than banker pay.
(As a proponent of the signalling theory of education, I'd also argue that the value of a lot of education is actually negative.)