The Lord of Light needed him alive to be a setup for other characters, obviously. What was he gonna do, just resurrect the important characters directly? Intervene right where and when it was needed? Nah that’s bush league god shit.
This is the guy that wouldn’t let his preistess leave the world until she assisted in genociding an entire Dothraki hoard just for the laughs. That was the yet undone act tethering her to this plane of existence. Think about that.