Madara of course planned everything, afterall he was for certain Obito would come back
(Madara chose obito because he had the chance to, not because he was planning on him from beginning he had lots of things set up)

We all know Madara is synced with Mazou

Tobi once considered syncing Sasuke to mazou when the time came (its in manga forgot what chapter)
And also Im sure madra wants Obito to be fully synced.

I mean the roots are already syncing to him (remember zetsu a part of mazou)
When obito getting his MS, we see the roots, be loose, then all of a sudden twists to the eye
maybe to show a form of syning to the mazou?