One time i was so stressed that i lost my adhd symptoms. I think that might be related to your experience, and dopamine processing.
My partner had a mental health flare up, which rolled into a marathon fight and almost no sleep. I wanted to call out from work, but once i started it felt like i had a super power.
I could just do boring repititive work until it was done. Then complete the next task. For a full day! No leaving my office for no reason, no realizing i'd been thinking about the bronze age for the last 10 minutes, no 30 minute side quests solving someone else's question. Someone asked me to do something that i didn't have time to do and i realized i didn't have time and actually said no.
Being absolutely shattered and maybe the most in-control i've ever felt was a weird combo.
My explanation has to do with dopamine processing. One contributor to executive functioning issues is overly-efficient dopamine processing in the frontal cortext. The motivation chemical comes in, you start to do the task, but then your brain's already processed all the dopamine so tough luck, we're off on our next adventure. The benefit of this is being resistant to the dopamine overload that cripples decision making in high stress situations.
I suspect that certain low-medium stress situations - being sick, tired, etc. - can produce enough extra dopamine to offset the issue, allowing neurotypical-like executive functioning.