In theory - universities aren't supposed to be primarily places of education, but places of research where the frontiers of human knowledge are being continuously expanded by people who have learned all they can about the current limits of knowledge in their field and dedicate themselves to creating new knowledge. Therefore education is a secondary purpose, merely the means by which the next generation acquire the base knowledge from which they can subsequently fulfil that primary purpose.
Highly respected academics who get senior positions in universities may have a variety of backgrounds because the building blocks of academic reputation is measured in terms of each individual's research impact - academic journals have a peer-review process where each person's research output is assessed for whether it is rigorously formulated and adds to human knowledge in the field, and once it is published the impact of that new bit of knowlege is measured in terms of how frequently it is subsequently cited - ie to what extent it is a building block towards creating the next layer of knowledge. Therefore if your research is doing something important that is subsequently useful to other researchers your personal citation impact increases. If you are a great networker and an interesting speaker at conferences then more people will cite your work in their own, and you really don't need to have started at Oxbridge to do well here. Universities are desperate to recruit academics with high impact because the periodical central assessment of each university department will count up the impact of the staff of the department.
Teaching undergraduates is relatively low in the priority list. You've got to do it because that's how your future postgraduate students, postdoctoral researchers and junior academics will eventually come from. The waste products of this process are educated graduates who don't want to be academic researchers who go off into the world and do something else.
The whole system gets skewed by governments deciding that this "waste product" is ultimately a good thing and starts pushing for way more undergraduate students than the above process needs, in order to supply the country with vast numbers of graduates. You therefore need to staff hundreds of universities instead of just a few dozen and frankly there aren't enough genuinely impactful researchers in each field to provide that staffing so some universities have staff whose research impact is somewhat mediocre, and thousands of undergraduates get degrees having learned in departments where very little impactful research is happening and with a relatively low chance of being able to springboard from that into doing impactful work themselves - although it is possible.
But looking at the original undergraduate university of people who are currently at the top of their field is confusing correlation and causation @MyJawisFred - the people who thrive in this system and who end up doing genuinely inspired and impactful research are going to have been intelligent and hungry for knowledge from an early age, and the process by which Oxbridge selects its successful undergraduate students is optimised to try to identify and recruit the 18 year olds who are most likely to eventually become highly impactful and inspirational researchers in their field in 10-15 years time. So its not surprising that there's a lot of Oxbridge graduates among the research staff of both Oxbridge and non-oxbridge universities.
However, the Heads of Departments are very rarely the most impactful researchers. Academics are not naturally gregarious or cooperative and leading them and getting them to do stuff is not an easy job. The HoD must have a sufficiently decent research impact to command respect but must also be a skilled diplomat and negotiator and have the personal charisma to get a bunch of sometimes vain, selfserving and backbiting academics to work together as a coherent department. That set of talents isn't quite the same as the talents of those who are actually the very best researchers in their field, who really don't want the hassle and admin of being HoD.