I have several friends who have successfully navigated switching research groups and even departments in the middle of their PhD work. I also know a few who didn't manage such a graceful transition, but it's definitely possible to pivot during the PhD without giving up on the degree and research career.
Perhaps it's possible under some circumstances. But I spent 3 years more than I wished to (as I see it now, I should have quitted, but by that time I thought that academia was the only intellectually stimulating option).
Change universities (Europe) would cost me at least a year, plus scrapping all previous progress. Plus, with getting a poor recommendation letter (more than likely when resigning) I would need to go a tier down.
I envied software engineers, who (if things do not work) could change their place in mater of weeks... and have money to support them for much longer, if there were need.
I know people who change, but it was never a trivial thing. (Maybe except when within a department.)
Now (living as a freelancer) I lover the freedom and flexibility. And, curiously enough, I get more of intellectual inspiration.