It’s always a trade off and there’s no right answer for everyone.
I spent my twenties roughly as you advise, and i definitely grew and learned from it. But some of my counterparts focused on career and have achieved more on that front and have been able to have more freedom in their thirties as a result. It’s not obvious that either path is better. There is no optimal