Yeah. And even if your last month listed coincides with a public layoff announcement, there are lots of people who jump ship very shortly after a layoff because being a survivor isn't much fun either. I know several people whose well-loved manager got laid off and they literally told me "yeah she's the only reason I could tolerate it here, I'm out." Talk about squad goals.
You can just say in resume:
Apr 2018 - May 2023: For-paycheck spaghetti code refactoring engineer in Large Boring Corp
May 2023 - current: founder and principal AI/crypto/quantum/whatever hacker in nextcoolthing.com