The real purpose of education, in high school but in general until your junior year of college in the American system at least, is to learn how to learn.
And advanced math involves the most unique and mind challenging ways of learning in a high school education. It involves memory, application, pattern recognition, etc but it’s about the only part of the high school curriculum that encourages abstract logical thinking. Literature does this too, but it doesn’t require it, and it doesn’t require the rigor in abstract thinking that’s needed in advanced math. In an argumentative essay you could hide flawed thinking with wordplay and any ways the logical accuracy of the argument only forms a small part of the grade but with advanced math there is no place to hide flawed logical thinking…there being a single correct answer, and the fact that math is a language that is designed first and foremost to eliminate ambiguity, means it’s hard to get away with sloppy thinking.
Advanced math that isn’t necessarily useful in your college career is absolutely essential to teach high quality thinking.
A statistics course, on the other hand, will almost certainly devolve into the practical and the useful, so much like high school physics will not teach thinking but simply knowing how to apply the right formula at the right time. That’s a useful skill but one that’s taught all over the current curriculum.
To the extent algebra and calculus are not useful outside of STEM degrees or in “real life” is indeed what makes them useful since it allows them to remain essentially the only abstract thinking course high school students will be exposed to.