Well, active player gets to choose the order, I think.
Normally, Rambasa twin dies, goes to discard, then gets moved from discard to codex.
Normally, with graveyard, unit dies, goes to discard, then goes to graveyard.
If you choose graveyard to act first, then rambasa moves to graveyard, but then the rambasa effect could either lose track of it, or more likely still move it to the graveyard. If you choose the rambasa effect first, then either the graveyard effect loses track after it goes to codex or pulls it from codex into graveyard.
All that to say, I don’t know