But the job in that gap was still in the same industry (management roles and startups). And big part of startup experience I could pack as hands on software engineering which it actually was.
And it happened not in the middle of a down market.
I still had to spend some time polishing cv and reaching for help, networking, etc. So it took couple months instead of couple weeks as with some of my engineer-engineer friends.
If you don't have any, then start working on one now, preferably a challenging one, for which you can show impactful results, then go to step 1.
2. Tie the experience and learning from those 4 years back into your career focus. You are now a more well rounded developer.
I have taken time away from my job many times. I am part time military so I have time away for professional military education and numerous deployments the other side of the world.
Here is what I have learned from this:
1. Employers love more well rounded employees with advanced experience other developers don’t have. They also fear that you may be absent again in the future. Reassure them.
2. Advanced outside expertise erodes compatibility. Most software developers in the corporate world exist in tight narrow funnels of expertise. That provides them no ability to ask questions like why the fuck are we doing this, because it’s all they know and all they can do. When you ask such questions there will be nothing but friction. At some point you will get tired of repeating stupid when you have learned to bypass it in your other personal adventures.