Nadia's blog post explores what she did instead of getting a PhD; you can in fact just spend several years immersed in a particular area of research and advance human knowledge without enrolling anywhere - although both funding and mentoring are often harder to find.
Some universities infrequently award an honorary doctorate to someone who is widely recognised in a field of study as working above the level expected of PhD candidates where a doctorate would ordinarily be required. Or occasionally to someone unqualified due to political pressure, but those cause severe reputational damage and are generally ignored.
Finally, it is very rarely possible to have existing doctoral-equivalent work recognised as fulfilling the requirements of a PhD, and graduate with a non-honorary doctorate without having enrolled (for long). The only case that springs to mind is George Dantzig, who solved two open problems in statistics thinking that they were homework; the subsequent papers later formed the basis of his thesis.
So in short: it's traditional either to enroll and get a PhD the usual (hard) way, or to so surpass the requirements that's it's more embarrassing not to grant you a PhD (harder!).
It might be worth doing some goal-factoring on why you want the PhD in the first place.
If you just want to advance human knowledge, one plausible option is to get a fancy tech job, save up enough money to fund the project you're interested in, then commission someone to do the project. Feasibility naturally depends on the specifics of the project.
PhDs can involve dealing with a lot of financial insecurity and oftentimes personal hardship to get through (with six years of opportunity cost and no guarantee of getting funding for your research interests at the end), so it's probably worth verifying that a PhD is actually your best option for whatever your personal goals are.
Is it possible to get a PhD from one of the research institutions, for example the PhD residency is pretty good initiative but hard to get into.
What are some examples of getting a PhD the non-traditional way.
Nadia Eghbal posted a blog about this https://nadia.xyz/phd