content note: death, old age, sickness
I've heard numerous anecdotal accounts of sick or old people who are on death's door "holding on" in a way suggestive that they were exerting some effort to do, until they had reached closure on some thing (a relative coming to visit, a manuscript published, somebody's birthday).
I could imagine this being a totally real thing that dying people can do for some limited time.
I can also imagine it just being cherry picked stories that were more a matter of luck.
It seems likely that there's at least situations where, say, eating is difficult/painful, and people continue exerting effort to do that so long as they have something that feels worth it to keep doing so, and then stop putting in the effort after hitting some milestone they cared about.
Some of the anecdotes I've heard implied something more immediate going on (where someone seemed to be holding on and literally a few minutes or seconds afterwards, died).
(Possible straightforward mechanism could just be that breathing becomes painful and difficult, and people only keep doing it when they have a concrete goal)