My theory is that these regrets eat you from the inside anyways. So the deathbed event is not a hallucination of sorts, but it happens because the dying lets go of their everyday worries and other such things, so their real motivations and inclinations crop up. And if they haven't acted on them, to a level that would be satisfying to them, then it leads to regret. As if they haven't lived their lives true to themselves. Which begs the question of the point of living too, of course. To which I have no clear answer.