I left academia after my PhD, with no regrets.
As a grad student, for the duration of your thesis work, you're locked into a specialty at a specific institute that isn't necessarily first-tier, may need to work at a level of intensity that prevents you from attending to a proper job search, and may end up under a professor who doesn't adequately support your career (e.g., with reputation and favorable recommendations).
In short, many things can go wrong, but you're focused on finishing. Under those conditions, if you do go straight into an industry job, it may be a shitty job that's not much better than a post-doc.
A brief stint as a post-doc gives you an income while you repair your career. This may involve changing specialties, developing your own research idea, working in a more prestigious institute or under a famous professor, or searching for industry jobs. Whatever it is, my own advice would be to only consider doing a post doc if it serves a credible purpose, otherwise, getting paid to get older isn't worth it.
In my field (physics), it was customary for grad students to work for their PhD advisor as a post-doc if they didn't already have a job lined up. I know lots of people who did that. It may inflate the number of "postdocs who leave academia" if it's not really a new job and their intention was to leave academia all along.
It's not as if there is a surplus of academic job slots that are going unfilled. The pyramid where one professor trains multiple grad students quickly becomes unsustainable.