I’d say this is a problem of compounding. The odds of any kid going on to get a PhD in math (or any subject) is vanishingly small, and is impacted by outcomes at every level of education preceding grad school. Saying that math is racist because there are few black phds in the subject neglects the law of large numbers. Few secondary teachers really understand math at a deep enough level to be inspirational… If kids from disadvantaged backgrounds are not shown how beautiful and useful math can be, what motivation would we expect there to be that could carry them far enough in the subject to get a phd in it?