The bug
If an allay holding a totem of undying and carrying a second totem of undying is killed, it will not drop the carried totem of undying. This results in the carried totem of undying being removed (see MC-249715). One would expect that, when the allay uses the held totem of undying, it would drop the carried totem of undying, as it does with other items when the held item is removed.
How to reproduce
Summon an allay
Right-click the allay with a totem of undying
Toss a totem of undying to the allay
After the allay collects the totem of undying, throw an Instant Damage II splash potion to the allay
❌ When the allay uses its totem of undying, it does not drop the other totem of undying it is carrying
Can confirm in 1.19.3 and 23w04a