Replacement effects and triggered abilities are fundamentally different kinds of rules objects. Replacement effects (CR 614) modify or replace an event as it happens, while triggered abilities (CR 603) watch for events that have already occurred and then go on the stack afterward.
When a creature would die, any applicable replacement effects are applied first (CR 614.1). If a replacement effect causes the creature to not go to the graveyard — for example, it goes to exile instead, or is shuffled into its owner's library — then the creature has not died, and a 'dies' trigger (which specifically watches for a creature moving from the battlefield to the graveyard, CR 700.4) will not trigger at all.
Only if the creature actually ends up in the graveyard after all replacement effects are applied does the game recognize a 'death,' and only then do any 'dies' triggered abilities trigger (CR 603.2). The triggers then wait to be placed on the stack the next time a player would receive priority (CR 603.3).
Concrete example: Your opponent controls a creature enchanted with your Imprisoned in the Moon (which is irrelevant here — let's use a clearer case). Suppose a creature has a dies trigger and your opponent controls a Rest in Peace (a replacement effect that exiles cards going to the graveyard instead). When the creature would die, Rest in Peace replaces the event: the creature goes to exile, not the graveyard. Because it never entered the graveyard, it never 'died' per CR 700.4, so the dies trigger never fires.
In summary: replacement effects always apply before triggers can fire. If the replacement effect changes where the creature ends up, whether the dies trigger fires depends entirely on whether the creature ultimately reaches the graveyard.
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.