If your manager is on the precipice of being fired you’re in a bad spot. This is also true of PMs. At mega corps you can and should change teams but in a rocket ship company there probably are no processes for that and even bringing it up is risky.
I don’t really have any advice here other than to be aware of it. My last job I got hired on to work under a guy with a lot of juice but then six months later he got promoted and I ended up with a rookie manager. Maybe I should have made a stink back then