Perhaps every case is different, but I hardly can imagine how one can remain motivated in a burnt out condition. It's not like the lack of motivation is the
cause here. It's more like the lasting effect that holds your capabilities down.
E.g. I still could read the assignment, understand the problem, even estimate how long it could take the former me to complete. Then continue wasting time in front of the screen, sometimes dabbing here or there, at 1/20th or so of normal work pace. The confidence sure suffers badly, but really it was down to complete lack of will to do anything.
There was a grandsibling comment that you can actually force healthy person to dig ditches and do other menial labor no matter what. This is a problem well studied by prisons and armies of the world over millennia. Thing is, whipping isn't usually tried with burnt out devs, who knows it could have worked. It's not like your IQ drops 50 points or something. USSR and China had a fair experience of forced intellectual prison labor, and things were getting done.
https://en.wikipedia.org/wiki/Sharashka