I've had to delete big chunks of code I wrote. Not because of burnout or exhaustion, but of sickness.
When I had a cold, but was good enough to sit up and type, I assumed I was good enough to work.
Nope. I've learned to monitor my health and energy levels better, and I stop when I know my productivity will be low (or negative)
I've heard people say this for years and have never experienced it, and I've done plenty of development while tired.
Certainly the next day, with a clearer head, I can see the mistakes I couldn't before, but I've never been so off-the-rails-wrong that I literally just trashed it all and started over.
I would be interested in a poll to see if this is a common thing for people. Do I have a super power in being able to work reasonably well in less than perfect circumstances?