This mod will allow your pets to continue their life even after death by respawning. This is actually quite fair since the pet will respawn the day after death.
Respawnable Pets Mod for Minecraft 1.16.4 / 1.16.3 / 1.15.2
This way you can get your pet back. You just have to wait for the next day and it will be reborn again.