I think handling https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/event/player/PlayerDeathEvent.php and modifying the xp level at that time will be enough (too lazy to look up if it does drop it after the event or before it)