The goal is to stay gainfully employed without having a stroke.
I used to have the same problem, but not when writing codes.
I love writing codes, and someday I was put in a lead/management position and the context switching between having to solve technical and managerial was giving me pain.
Then I allowed myself to make some mistake. Giving myself a sandbox to play in. That really helps.
Totally agree about context switching. I'm pretty much worthless at it.