Tobi is Izuna Uchiha, whenever Kishi gives us the "surprise on top of surprise" spin, the latest surprise is ALWAYS the truth. This IS the real Madara.
Since he knows his own brother well, he immediately knew that this whole thing was Izuna's doing. Kabuto had shown him to Izuna once before he brought him from the coffin, which is why he acted the way he did.
Since Madara said he unlocked the Rinnengan just before his death, it's safe to assume that he achieved this DURING his fight with Hashirama (with years of experience with the EMS already under his belt, he was pushed to his limit during the fight and STILL came out the loser, i.e - "just before my death", he didn't say a month, a year, or a century before my death, he said JUST before XD)
His brother laying dead on the battlefield, Izuna was free to take the Rinnengan and do what he wanted with them. i.e - Give them to Nagato
At that point, being the brother of Madara and possessing the Mangekyo already himself, he was powerful enough. Now the only question that remains is "WHY THE **** DIDN'T IZUNA KEEP THE RINNENGAN FOR HIMSELF WHEN MADARA DIED?!"
Good question. But I believe when someone dies their eyes go dormant for awhile. Simply look at how long Sasuke has been in healing / meditation until Itachi's eyes reactivated.
The eyes were dormant when he took them from his brother, so he found a subject with the necessary traits to make them active. (A Senju descendant aka an Uzumaki). Thus he began his master puppeteer roll in Akatsuki.
~and the story continues LOL 5/5 GO KISHI!