After the battle with Ganondorf (Ganon form), Zelda along with the other stages were able to use their powers to seal the king of evil and he reverted back to his original form. Then for Link to regain his lost seven years of time, Zelda sent him back to soon after the start of his adventure. Judging from one of the cut scenes it is before Ganondorf launched his attack and Zelda is still at the castle, meaning this is before Link returned to Hyrule Castle Town after gaining the last Spiritual Stone.
Navi then leaves Link now that their adventure is over and Link sets out to look for his lost friend. Why Navi left and where she went no one knows and no one ever will.
We then enter the game The Legend of Zelda Majora's Mask where we meet the Skull kid and the mask itself. We know that Link defeats the mask removing the spirit from it and saved the day. But what we must take from this game to continue with the theory is the location where we first meet Majora's Mask and the Skull Kid.
The plan was to destroy the world by colliding it with the moon!
I don't think that Majora's Mask planned on his own destruction so I doubt he planned to stay their. Even if he did plan to stay and watch what then? I'll tell you.
Before he turned the moon to impact Termina he went looking for his next target. That target would just happen to be Hyrule, the place where he ran into Link. That's right! After Termina, Hyrule would be Majora's Mask's next target, and if we look at the timeline again we would see that only in the Child timeline did Majora's Mask appear, but what if he did appear in the other timelines.
Lets move on to the Hero Dies timeline.
Hearing that a hero would show up at some point to stop Ganondorf and that the pieces of the Triforce would eventually come together, Majora came up with a cunning plan. He would wait for the hero and Ganondorf to fight, and after would jump in to finish off the survivor.
What he didn't plan on was Ganondorf's transformation into Ganon which because Ganondorf went wild and lost control of his piece of the Triforce and because he wasn't stopped in this timeline, the transformation was permitting as evident by Ganondorf not appearing in the following games and instead Ganon.
When Majora jumped out to finish Ganon, he was caught and killed by the evil king. So Majora's tale in the hero dies timeline ended.
And finally the adult timeline.
They were apparently transported somewhere else, meaning that Majora missed his chance to attack. Link was sent back in time and the Triforce of Courage was hidden away, At this point Majora could of just dropped another moon on the world but wanting more power went to find a way to obtain the Triforce of Power for himself.
Eventually Majora would be the one to release Ganondorf, most likely to then attack when he's off guard or maybe he meant to just release Ganondorf's Triforce piece, either way Ganondorf was back and he made sure to finish off Majora this time. Ganondorf would then go attack Hyrule and with no hero around because he was sent back into the past and the spirit of the needed more time to reincarnate, the Gods decided to flood the lands leading to the game the Legend of Zelda the Wind Waker.