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.
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…