An anecdote: well, several anecdotes. I know four people with maths degrees from top universities who ever tried to go into maths teaching. (That it's so few is part of the problem right there.)
a) Struggled with his maths degree, but always loved maths. Passed with effort. Went into teaching in a leafy sixth-form college. Probably does an excellent job.
b) Did well in his degree. Loved helping people who were struggling, did well at it. Started a PGCE. Was threatened with failing because he insisted on giving different work to the most able students in his placement class. (I can easily believe he wasn't doing it in the best way, e.g. he might have been giving them the following year's work instead of stretching them sideways - but the instruction was not "here, do it differently" but "stop doing it, give them the standard work, or we'll fail you".) Gave up the PGCE in disgust, went into IT.
c) Did a PhD, spent some years in research, decided teaching was more fun, did a PGCE, did well, started to teach in a state school, found the bureaucracy intolerable, moved to an independent school.
d) Early history I don't know; went into IT; enjoyed the management side more than the technical side; did a PGCE, went into a state school, was quickly promoted to head of department where she still is. Very organised, no obvious enthusiasm for maths. The school does OK but not brilliantly given its intake; I suspect she has the skills to keep the bureaucracy from drowning everyone but not the maths enthusiasm ideally needed.
Stretching - which is to say, teaching - the most able takes resources. You can argue that this comes too far down the priority list to get those resources, in all state schools or in state schools with high FSM percentage, or whatever.
However, if you do that, then you can't legitimately go on to complain about how few people from state schools or from state schools with high FSM percentages get into the best universities, or get the best jobs - because your policy caused that, since the better-taught high ability students from other schools will come out better equipped to win any fair competition.