Having a player character croak in the midst of a multi-day dungeon adventure does suck, especially if it is a popular character or has been around for ages. I was always the Dungeon Master, and part of my job was to pre-stage non-player characters.

Besides the typical tavern folks (which had a decent selection of five or six, pre-equipped with a history and personality type), each dungeon had NPCs hidden throughout the place. If nobody was dead, the NPCs would act like random encounters. If a character had been killed, I would hand over the NPC to the player to take over. At the end of the adventure, they had the option of keeping the NPC.

I also allowed divine intervention (rolling four 0's on d10) and possible reincarnation after the adventure was over, if someone kept something of the dead character. Usually the cost was very dear to the party, so that was rarely attempted.