To reproduce, equip a totel of undying and run /kill. You will die.
MC-110089 Totem of undying doesn't prevent /kill
MC-238191 Totem of Undying won't save the player from kill command