My advice: Have one or more side projects going all the time. If you get laid off, immediately start doing a startup, open-source project, or volunteering full time. A year of unemployment? Lonely, depressing, and not good on a resume. A year of launching an unsuccessful venture? Running coding classes for the underserved? Focusing full-time on contributing to pytorch? That's a lot better, both at the time and in ret…
The only advice I'd consider paramount is to take stock of themselves financially and mentally, to assure themselves that they can take on the chaos and uncertainty that follows.
Honestly, if someone showed up with a gap in their resume and claimed that they were doing start-up, open source, etc. for an interview, I'd dig deep into that hard. The open source contribution/project would have to have a sufficiently high bar for it to be even considered. Else, I'd just assume they were being less than honest. I'd rather someone tell me they spent a year working on themselves, playing video games, hiking, etc.