Aside from actually enjoying the work, I had a salary / scholarship that where I went to school was the same or more than most of my peers who went right to work made (because of tax implications), and when I got a job, I got a better one than I would have otherwise. Plus, many people I started school with had barely finished their undergrad by the time I was done a PhD because of the usual breaks and major changes and failing courses and stuff.
I'm not saying this to brag (I've made all sorts of terrible choices since then), only to say that it's possible to do a PhD, have fun (specifically in the sense of learn cool stuff, although I enjoyed the social life), and not make a "sacrifice" in terms of money or starting a career. It's like any other job. You can make all kinds of early career decisions that help or hinder you later, generalizing a "phd" as some specific thing doesn't work
* (I like to think I'm coming back to another such period 15+ years later, but anyway)