You hear a lot about burnout, the phenomenon where chronic overwork, stress or resentment leads to increasing unhappiness and an eventual breakdown. It's happened to friends, it's happened to me, and by all accounts it's a fairly widespread problem both in the software industry and elsewhere. But I think what we call burnout isn't a single thing, but actually two distinct phases, one acute and one chronic, and part of what makes burnout such a tricky problem is that those phases have opposite solutions.
The first, acute phase is a wildly aversive reaction to your current environment. This is the point where the building unhappiness with your situation finally gets too much. You were probably getting less and less effective as your happiness decreased anyway, but at some point you just can't deal with it anymore. It goes from being a bad situation to an intolerable situation, which usually manifests as quitting, avoiding, or aggressively underperforming at your work. In this case, I would say the burnout is a perfectly reasonable response: you're in a bad place, you had the warning signs telling you to get out of the bad place, you didn't do anything, and now your hand is being forced.
The second, chronic phase comes afterwards, when the original problem has gone away. Now there's nothing directly stopping you from being productive, but you can't bring yourself to go back to doing anything useful. It's like there's an invisible wall between you and the thing you used to enjoy, and every time you go to do it just about anything else seems like a better idea. This stage is self-perpetuating: the more you don't do, the more you get used to not doing. I believe this phase is really characterised by a bad association that has formed, at first because of the emotional strength of the first-phase burnout, and eventually through habit.
And this is why I think the advice about burnout can be very confusing. If you're in that first phase, the common advice of "take a break, go on holiday, get as far away from the situation as possible" is absolutely correct. The immediate acute problem won't go away until the reason for it is removed. However, in the second phase, the most important thing is to not take a break, but to pick yourself up and get back to doing something. That's the only way to fix the bad association that you've built with your work.
Of course, it's not possible to remove an association, so what you have to do instead is build a new, better one. As with many other things, Feynman had this one right: rather than go back to what you were doing before, you need to rediscover the positive feelings that brought you to your work in the first place.