We know madara knew about it before his death
(Meaning it was created during his lifetime).Some say why don't we readers ever see it.
What most forget is that the show is called naruto the date is was created is irrelevant.Why it was created is irrelevant.
Its not tobirama's story kishi is trying to tell.He is merely a page in the overall scheme of things.
Anyway madara did at one point live the in the village he helped create,we just don't know how long before he left for good.He helped make it and was the leader of his clan so his status and position was at the top.So its safe to say he knew what was going on most of the time.
We also know he mastered the yin,yan and the yin-yang release which is dealing with pure spiritual energy and life force.
Its what gave birth to the creation of all things.
I can't tell you how specifically (Nobody can until kishi decides to give an official detailed explanation.)
But,the jist is he undid the part of the justu that binds his soul to kabuto so when he released the justu it would not effect him.Edo tensei is the act of transporting the soul somewhere else.Its not like he broke the justu itself,he still an edo.
Madara simply cancelled the bus ride home.And since kabuto is still in remission nobody can activate the process again.(though not entirely sure if doing it again would result in a different outcome since he could possibly just do it again.