Huge opportunity cost for 5-8 years, think carefully. Also, very very few jobs in academia so don't plan on those. Was interesting and learned a lot, not sure the most useful use of those years.
indeed. a few folks in the FIRE (financial independence / retire early) space talk about being able to save enough money to be retired or semi-retired from 7-8 years of full-time work (this doesn't require FAANG scale salaries, just a combination of working somewhere that pays pretty well, not spending much money, building up investments, and luck to avoid getting clobbered with huge medical expenses. and the luck to start from a context where this might be an option for you at all)
edit: adding a few links to reading material
One of the main things is to focus on maximising your savings rate, i.e. your amount of savings divided by your revenue (for most people this would be their income from their job, minus income tax). You can increase this by making lifestyle changes that let you sustainably decrease your expenses, and by getting a job that pays you more, or other sources of income.
William Bernstein has written a bit about investment and asset allocation. He has a free publication titled "If You Can" geared at young people to help them plan for retirement: http://efficientfrontier.com/ef/0adhoc/2books.htm One of his general pieces of advice is to invest 15% of income every year into low-fee investment funds, i.e. to achieve a savings rate of 15%. If you do this consistently for around 30 or 40 years, you can retire.
Things get much more extreme for higher savings rates. For example, if you hit a savings rate of around 75% year after year (saving three quarters of what you earn after tax) and invest this, then with some assumptions about rates of return on investment, after about 8 years there should be enough income from investments to cover your expenses:
You need to be a bit careful re: assumptions about stock market returns over the next few years or decades, some markets (e.g. the US stock market) are priced very highly compared to historical prices, so assumptions about rates of return from investment that seemed reasonable a decade ago are probably over-estimates now.