Autism and ADHD are highly layered with maladaptations. You get a domino effect occuring, with the obvious symptoms down the chain. Other conditions can function similarly, and pull in the same maladaptations.
It’s also worth noting that ADHD and autism are spectrums. It’s possible to have mild tendencies that don’t technically qualify. When other conditions cause disruptions, the symptoms can get more pronounced, or lead to additional maladaptations.
That’s executive functioning failure. It’s common with ADHD (which is strongly comorbid with Autism) but not unique to it.
Basically, the part of your brain dealing with task focus is either asleep or exhausted. At that point, you are running on pure impulsiveness.
If you get locked in, the best bet is to stop banging your head against a brick wall. Stop trying to do the big task, that is stressing you. Instead aim for a small, neutral or positive task to lock on to. E.g. throwing together a sandwich, or going to the loo, rather than “I REALLY need to get my taxes done!” It’s a far from perfect method (it still fails often), but it does help kickstart you back to higher brain thinking.