I also like the madness idea. I would just adapt the madness rules in the DMG to apply to resurrection. The idea being that he resurrection is fraught with risk and the more times you die and your soul brought back, the more likely your mind may break. Depending on how frequent death is in your game, I might, however, let the first time be a freebie.
The guys in Web DM discussed an interesting idea in their recent Youtube video titled "Modrons Inevitables & Cosmic Law" (
https://www.youtube.com/watch?v=0GrDnECYh_c&t=1239s). While the focus was on Modrons and how you might use them in your campaign, they also discussed bringing "Inevitables" into 5th edition. I never played editions of D&D that had inevitables (at least I don't think they were in 1st edition) but they sound cool. The idea is that if you are resurrected too often you'll be seen as breaking natural law and will attract the attention of these planar being who seek to enforce certain fundamental laws. They hunt down liches and such and if you are resurrected too often, you may attract their attention.
If you don't like their construct, machine-being nature, or don't want to do the work of bringing them to 5e, you could reskin a powerful angel to play the role.
An eerie suggestion they had that I really like for giving death and resurrection some gravitas is that when resurrected, you may glimpse visions of them. Maybe the first time you are resurrected, you have the sense of being watched, that something took notice.
The next time, you see some vague form in the distance watching you, filling you with cold dread.
The third time, you see this terrifying before you, being staring at you. The words "never again" echo in your mind as you come back to life.
A mixture of the madness rules and the use of inevitables could be very interesting. Perhaps a character that has cheated death far too often could be hunted down, but when they are inevitably caught up with, if they are good or lawful, perhaps instead of destruction, they are given a choice: if they kill some lich or necromancer they will be given a reprieve. So long as they are agents of the lawful forces enforcing the laws of life and death, they are allowed to become resurrected, but with ever greater demands being up upon them to balance additional resurrections.