It took me many years to learn, and learn to the core of my being, that spending one minute more than is necessary in a truly untenable work situation is a bad idea for me, personally.
I hung in on several jobs, for several years, beyond when I knew I should have just quit, but couldn't bring myself to do it "without something else" already waiting.
I eventually landed in a job at a gaming startup that was run by two people I very quickly recognized were utterly unstable and would be impossible to work with. I quit right around the 2-week mark with nothing else waiting. I had another job where I was expected to go on-site (in other states) quite a bit where my boss could not learn how to accurately assess whether that was necessary, nor whether I'd have adequate support from the customers asking for on-site assistance. In addition to that, she'd come in and announce, "You're going to Arizona on Wednesday," when it was Monday or Tuesday, and think I was supposed to just do that with zero time to arrange for pet care, etc. Sorry, honey, but no. We either work with each other, or I don't work for you. I quickly resigned that position, too.
We are in one of those rare areas of work where still, overall, it's reasonably easy to pick up your next position if you have experience, but not so much experience that you're "too expensive" for the sort of positions you'd like to have. But these days it's not like it was in the go-go 80s and 90s where you could quit your job one day and really count on being employed again in less than 2 weeks (if you lived in a major metro area).
Recognizing a no-win situation (and what, exactly, that is will vary from person to person) and being willing to extricate yourself from it rather than letting it destroy your life and emotional state as you want to have both is a skill worth learning. When your gut is screaming at you that there is no good outcome, you can be sure there
is no good outcome.