I was fortunately able to leave a terrible job 2 years ago and immediately had contract work, now I run my own business and get constant referrals from my network. I make more than ever, have incredible work-life balance, and for the most part love what I do.
If you don't have a network, the moment you quit/lose a job you are dead to the world. Even now I have people approaching me for FTE roles, I haven't even worked with them for 2 years. Am I some god tier programmer? Not really, but I have a good track record and people always want to go to someone they already trusted.