I’ve always wondered about that myself. All those “deathbed confessions” and the sort. I do believe - dependent upon the person, and what is in their heart - that to live a life of sin and then ask for forgiveness right before death doesn’t necessarily get someone “off the hook” so to speak. Like you mentioned GENUINE repentance is one thing. I think when one is faced with death the fear may interfere with the “genuine” part...
I’m just glad it’s God who knows us inside and out is the one to judge. We can speculate on this all we want but when it comes down to it, only He knows really... Better not to wait - after all, not everyone knows when their time is almost up...
Fear drives a person to God many times when other things fail. The transaction of faith once God becomes clear can be very, very quick.