This question already has an answer here:
The Scarab God's text reads:
When The Scarab God dies, return it to its owner's hand at the beginning of the next end step.
If I have Mirage Mirror in place and my opponent attempts to exile The Scarab God, can I in response, make Mirage Mirror a copy of it, then select the original Scarab God to be put into the graveyard, and finally return it at the beginning of the next end step?
The Legendary rule reads:
If a player controls two or more legendary permanents of the same name when state-based effects are checked, that player chooses one of those permanents and immediately put the others into their owners' graveyards, without any player having an opportunity to respond.
Is that "put the others into graveyard" considered "dying"?