Everyone should memorize this adage. Sometimes making a change is the right decision of course. But I've also known a lot of people over the years who just got an itch to make a change because of some relatively minor gripes. And things did not work out as hoped.
Academia in particular is easy to idealize based on successful tenured professors at top tier universities who seem to have a pretty good life.
Most people have a built in bias to stick with what they know rather than trying something new. We probably stay in bad situations much longer than we should. Ymmv
One key is probably to really ask yourself why you want to make a change (or why you're hanging around if you don't really like the situation). If you have good answers, that's fine. If you don't...
Ultimately you have to make decisions based on incomplete information and with the knowledge that no situation is likely to be perfect.
It takes effort on my part to control envy from others. I actively suppress it.
If you want to do academic research (and teach a lot), you are definitely young enough to get a PhD. But make sure you are switching because academia is what you love doing, not because you hate your current state (success in academia requires a major committment). My 2c.