I think the "underpaid teacher" thing isn't necessarily rooted in reality,. especially outside of the US. My wife is a teacher in the UK, and she's a head of her subject. For many years her pay was similar to mine as a software engineer, but everyone often treated her as if she was poor and that I was rich.
In Australia I don't think teachers are underpaid, but schools are absolutely underfunded. Which can often mean teachers end up spending personal money on school resources, which means their actual effective pay isn't as good as it looks from the outside.
They also work way longer hours than is reflected in their contract.
To be fair, outside of London you'll find that the starting salary for many degree-level jobs is around that, including jobs like software developer. I'm in Bristol, and the pay disparity is hilariously bad - a senior designer will earn less than a manager at Burger King...