Excellence can also be found in independent reading, and it can be learned with professional mentors as well.
You can learn it from AI, too, actually. I'm skeptical about the central use of AI in writing code directly, but find it incredible as a teaching tool. It is especially impressive when I use it as something between a tutor and a search engine, talking to it a lot about the best way to do things and asking it about standard methods and resources. It's not infallible, to be sure, but it's this incredible combination of tutor and textbook, with a better connection to the zeitgeist than all but the very best of tutors and textbooks.
In this way, AI is not dissimilar from school, independent reading, or work experience: you can use these tools in different ways, to serve different goals. If you focus on credential, skill, productivity, and money, you may entirely miss out on excellence in your craft. On the other hand, you can pursue excellence in any of these contexts.