That is not exactly what the OP is asking for. That just pauses XP gains after you respawn, you don't actually lose any XP (once you earn enough XP, then it resumes adding XP to the character). It's like you are given a XP loan on death and have to pay it back before you can save any XP for yourself.
Passive effect PlayerExpGain is what adds experience to the player's character. I did some tinkering with it in the past and you can actually set it up to remove XP from the character (not sure if the player drops a level and what happens if they re-earn that level - do they gain another perk?). However, I had it tied to player actions and not to the death, so not sure if you could add that.