dnd 5e – Is there a 5e magic/mechanic that could cause an item to disappear/teleport/planeshift on death?

I am running a 5e campaign where my players may encounter the Xanathar. Being the murdering hobos that they are, they may eventually successfully kill him since he is just a normal beholder stat block. He has a couple magic rings, including a Ring of Mind Shielding.

I was thinking of having his soul go into the Ring of Mind Shielding on death and then have the ring disappear to a place he can be true resurrected/wished to life later on.

Would there be a mechanic/spell that allows me to do such a thing? I try my best to make things within the rules instead of just DM ‘it happens because I say so’. In Hoard of the Dragon Queen, Rezmir has a chest on Skyreach Castle that is similar to my question. From Page 79:

In addition, the chest here is locked and magically attuned to Rezmir so that if she dies, its contents are teleported to the Well of Dragons and out of her slayers’ hands.

However, it does not go into what caused this chest to do so.

Thanks in advance! The loss of the Xanathar to the realm would be truly disappointing.