There’s a lot of points I agree with but I think what’s important is fully conceptualizing the mental model of your project. Then, context switching doesn’t even induce much mental fatigue.
Don't you have a fully conceptualized mental model of your body, to the point that you are quite functional with it? Isn't your body far, far, far more complicated than any software project could be?
I only have the most vague mental model of my body [0], and I also don’t bio-engineer its cellular innards, which would be the rough equivalent of what a developer does in large software projects.
[0] Which becomes painfully obvious when one ages, as all kinds of things start to hurt, and one doesn’t have a good understanding of why exactly, and how to stop it.