I've taken a couple breaks between jobs; about 9 months each time. The key is to save money while you are working so that you have a buffer. Obviously, it can be tough to save money. I did it by never getting comfortable with how much money I made; I lived like I made a lot less. (Basically, stock was half my compensation, but even though I auto-sold it whenever it vested, I mentally valued it at $0, so that was free savings. I did all my planning and forecasting around base pay. That is less possible if you have a family to support, but it is also very low risk. Everything financial is a matter of how much risk you're comfortable with. If you take on more risk for expenses, you have less of a buffer for "I don't feel like working" or layoffs.)

A lot of your money is going to be for housing, and there are a lot of "conventions" that I think you should be careful with. Housing companies will tell you to spend 30% or more of your gross income on housing. You can do that if you want, but you'll have more savings if you aim for 10-15%. It's quite possible; I've lived in a nice neighborhood in NYC for 10 years and pay about 16% of my gross income on rent. (Rent stabilization is a powerful force, though, and you kind of had to be here 10 years ago to be paying 10 years ago's rents.)

Similar stabilizing forces apply if you have a mortgage as well. If you get a 30 year fixed, your monthly payment isn't going to go up over 30 years, but the value of that money is going to decrease, so it will be less of a burden over time because your income is likely to be adjusted to inflation over time. My advice to myself from 10 years ago would have been to buy and not rent; the dollar becomes worth less and less over time, but the roof over your head remains as useful as ever. If you have savings, the dollar decreasing in purchasing power just wipes out your savings. If you have debt, then the amount of time it takes to work off your debt decreases instead. Rent stabilization does give a lot of this advantage to renters, but it's rare throughout the US, NYC is kind of an anomaly.

Regardless, always be working on building that buffer. You want to be able to pay for housing for 1-2 years without working; once you have that buffer, then you can decide to use it to take time off, or you can keep it stashed away for "quirky billionaire buys my company and fires everyone". (Such things do apparently happen.) The lower your monthly expenses are, the easier that is, so keep your expenses low. The expense that I think is easiest to dig into is food; it can easily be $25-$30 to order a cheeseburger and fries for delivery (at least in NYC), but you will be hard-pressed to spend $30 on ingredients to make a single meal. If you have any free time whatsoever, there is a lot of savings at hand. If you have no free time, then hopefully you're being compensated for that.

I suppose the elephant in the room is the disparity in pay between non-FAANG and FAANG (or whatever people call it these days; Facebook, Amazon, and Netflix seem to be facing hard times, Google definitely seems interested in reducing compensation across the board, Apple's still doing pretty well), and things like that. There are no doubt great software engineers making $70k a year doing the same work that Google is paying people $400k a year to do. Try and get that job, and everything will be a lot easier for you. HN hates this, but if leetcode is what's standing between you and 4x the pay, you should probably just practice the leetcode. Your safety net and quality of life will increase dramatically, even if you move to a high-cost-of-living area. I definitely did that when I was applying to Google 10 years ago, and it was probably the best investment I ever made. $50 worth of books and a few evenings trying the exercises, and I got a 3x pay increase and a free move to NYC. Would recommend considering it.

(BTW, it seems like every company in existence has min/maxed the cost of living thing; so you are unlikely to get ahead by moving to a low cost-of-living area. Your employer will just pay you less and keep the savings for themselves. But if you start cooking food instead of ordering it, they'll never know, so that's free money for your savings and investments ;)