Hey: I have a theory what happened after the fight with Hashi.
Madara died in the real world. But his Clan did not organize a proper funeral or jutsu which is needed for an Uchiha soul to cross the lines finally.
That is why Madara was trapped between the two worlds. He got mad at his clan and therefore helped Itachi / or sended Tobi to help for the massacre. (There is a slight chance that the Uchiha are still living in the world between and that is where Sasuke and Oro are currently heading. When Oro was absorbed by Kabuto maybe he was also in this in-beetwen world)