D&D 5e already has a few mechanics in place to make death unlikely. Death saves mean that even a character who is completely isolated when they run out of hit points won’t necessarily die. A TPK will likely result in some actual deaths, but many characters will make their saves and revive. Declaring that all PCs make their death saves and revive a few hours later whenever they go down for any reason wouldn’t be any more of a reach than making short rests five minutes and long rests an hour (an optional rule presented in the DMG). Characters stir back to life, left for dead on the battlefield, some of them dragged off into piles of corpses not yet burned, others lying in a ditch where their “dead body” was shoved to make room for soldiers marching into the town they were trying to defend, some awaken where they fell, and now the scattered party must regroup in the ashes of their failure, the town burned, the good king captured, and the forces of evil triumphant. Everything valuable, most certainly including any magic items that weren’t concealed or disguised somehow, has been looted by the victorious enemy and is now being either used by powerful enemy lieutenants or else, if they can’t use it themselves, stored away as a trophy and treasure.