I've completely blanked out more than once on pair programming where my attention went into what I like to call "brute force mode", where your working memory scatters every few seconds or so, and you keep starting thoughts from scratch.
It honestly feels like torture to me.
Switching tasks lets me reset from this state well enough, so I consider it essential coping.
Sometimes it helps me to have an external force help direct my focus.