Because if your employer doesn’t pay what you’re worth to other employers, you go to those other employers.
It’s easier than ever to see what jobs are worth as many locations require employers to publish salary bands or hourly rate right on the internet. You can find all the jobs near you that are similar and compare pay without so much as going on an interview.
A couple of things. First off, teaching is unique - every public school I’m aware of is unionized. Which is to say there is a collective bargain between the workers and the district. Teachers have far more say in their pay than non-union employees.
Secondly, they can go teach in private schools if they pay more or change careers if they think they can get paid more or have a better quality of life doing something else.
Or they can simply try to get people to vote down their next CBA if they think they aren’t paid enough and force the district to pay more.
Third, I never said anything is “worth it”, but the calculus for teachers is different. The CBA getting voted on by the teachers means your compensation is heavily backloaded towards end of career and retirement. You also have significantly better benefit plans than private sector jobs, because that’s what the union membership voted for.
You can retire in most school districts after 20 years and get paid 2/3rds of your salary for life. Good luck doing that in the private sector. Which is why you’ll also probably get paid less than other jobs with comparable skill sets over those 20 years.