What exactly is the "Ritual of The Divine Tree"?
They live in their ideal worlds but while that's happening the tree is turning them into white Zetsus and I think somewhere in that process their brains turn to mush killing them. Thats where they got the army of Zetsus in the first place (by sacrificing people with the ritual turning them into Zetsus).