Madara is irrelevant. All the while he was with Madara recuperating from his injuries, he had all the resolved in the world to reunite with Kakashi and Rin and the 4th. Obito became only decides to become a hypocrite when Rin dies. And lets not forget that Obito more likely than to had have family back at the village, presuming, of course, he didn't raise and provide for himself during infancy. Yet he chose this obviously ill-intentioned stranger living an an underground lair by himself instead of his family and village. It all doesn't make any sense!