Are undergrads applying to top math Phd programs expected to have taken core graduate clases?
No, possibly except for Princeton.
Berkeley in particular has a long tradition of accepting domestic graduate students who have less background but strong potential.  (I had not learned Galois theory or anything about manifolds when I started graduate school there, and I still have never learned the Lebesgue integral.)
Graduate admissions committees in the US trust what recommendation letters say (with evidence) about the potential of students, and take that into account a great deal, in many cases attaching more importance to this than any actual achievements of students.  Their statistics based on how students have done in their programs and after finishing is that how much math you know coming in actually doesn't make much of a difference; much more important is your demonstrated capacity to learn math and solve problems.
Keep in mind that it is quite possible to do quite impressive undergraduate theses despite not knowing much mathematics if one has a good advisor (who can explain how the problem can be reduced to an elementary(*) one), works hard, and is clever.  (It's quite common for PhD advisors to complain that their weaker students don't actually understand their own dissertations.)  Keep in mind that undergraduate admissions at Harvard or Stanford is extremely selective - generally more so than graduate admissions in fact - and every student at Harvard or Stanford is very clever.
(*) elementary meaning not requiring knowing lots of mathematics, not meaning easy.