Maybe Legion made a mental copy of Dani as a backup plan to use against Nate. Or completely "downloaded" her mind leaving a Danilocke shell behind, as Havok83 suggested.
If that's the case... Well, Legion did turn Chamber back into a mutant again during Age of X.