My art history example does fly if we're talking about students. The question then would be - what about faculty? Why is faculty still mostly male when students are mostly female.
And the answer is that the faculty selection process is - for art history as much as for other faculties - skewed towards a narrow sub-demographic that is predominantly white and male from a well-to-do background. If you call that discrimination I'll agree with you, but it's not a kind of discrimination that would be specific to either art history or computer science.
Even if you look outside Stanford https://art.vassar.edu/bios/ you can see a definite difference in gender distribution between adjuncts (poorly paid, mostly female) and full professors (mostly male).
At least in Germany, this is being changed by rules that give female applicants preferential treatment when there are (as is common) more male than female applicants for a professorship, and at least in female-dominated courses of studies we now see more female professors.
So we seem to have gender (+other, less visible) discrimination in many cases where managers, professors and other roles are selected in a competitive manner. And we have ways to change this if universities and private enterprise play along. But this has nothing to do with females not choosing CS as a major, and it has nothing to do with females not entering programmer jobs.