I have a theory I think is true.
Obito was found by Madara that manipulated him as a tool and saved his life because of it.
Obito fell for it and took Madara's identity to spread fear and fulfiull Madara's plan that was created by a lie made by Black Zetsu.
Obito pretended to be Madara...