Overly critical thinking causes way more mental strain than necessary. Near constant pressure to conform with the latest book will of course cause burnout. Just write the flow you worked out in your head, because you already know it'll work before you even start typing.
Maybe programmers sometimes need to go off on a "not standard" bender once in a while to let their creative juices flow again. I'm pretty sure that's where the best code comes from anyway.
My personal solutions include:
Going to the gym or playing a game of tennis at least once or twice a week. Yes, during the working day. I prefer to code at night anyway.
Taking an hour off for lunch, during which I go for a brisk walk and pay attention to my surroundings, etc. Not stew over the latest problem.
When I catch myself spinning my wheels over some problem. I get up, walk to another desk which has no screen, keyboard etc. Take a sheet of paper, write down what the problem is. Close my eyes and let my more relaxed brain come up with a solution. Write down the solution and then go back to the desk with the computers.
Obviously YMMV, but it is helpful to recognize that when mentally fatigued, you are working sub-optimally, so why beat yourself up. Just take a break and let your brain actually rest. BTW, sleep is natures way of forcing your brain to have time out.
On the other hand, if there is no specific deadline for a specific piece of coding, it's best to walk away from that task and leave it for a while. That 'while' might be as little as a few minutes or as much as several weeks or months.
Generally, during that period, your mind is still working on the task in the background and sometimes almost 'out of the blue' the solution will present itself.
In any case the time spent away from the problem will wipe the slate clean enough so that you come back to the problem without the previous mindset and/or ideas that were your mental block. By starting afresh on the problem, you begin to look at it from another angle.
Anyway for me I hope I can go to the park/do something none coding like a hardware project. TV/gaming. If none of the above binge eat and pass out (not great).