Even if it is a red flag to some, I strongly believe software interviewing is a numbers game, due to randomness and bad interview processes. And once you do get a job and get back in the workforce, if you don't like it, you can switch again. And you at least won't be in the middle of a current gap.
I'd just definitely have a a go-to answer when you interview, and medical is a totally fine answer there. I don't think any competent hiring manager would ask past that due to legal risk (although there's always someone who asks illegal questions at interviews anyway).
Best of luck!