Also, to get top dollar, you need to make sure you don't have unnecessary time off for having babies, looking after sick children and you must always work FT.
But the same applies to climb up the teaching ladder too. To get to an SLT position in a secondary you would also have to work FT and probably minimise time taken out for maternity leaves etc.
Again one has to compare like with like. A qualified accountant working part-time for a local firm won't earn as much as somebody working full-time in the top firms, rapidly climbing the ladder. But the former is much more comparable with a teacher working part-time, not progressing up the salary scales and not taking on responsibilities beyond classroom teaching.
My own university estimates the median salary for maths graduates 10 years after graduation to be several times the mean teacher salary quoted above. This is on the high end, as many of our graduates go into finance, but I don't think anybody would claim that teaching is comparably paid to typical jobs for maths graduates.