Because Obito had time to do all that. Not to mention this is all said without any proof.Ughh imma break or down into steps for these people...
1. Madara/Obito uses Sharingan to forcibly control Kurama
2. Since Kurama is under their control, with no free will, they use the control over Kurama to forcibly create a contact with him
3. They gain the ability to summon Kurama whenever as long as
a.) Kurama is under their genjutsu control
b.) They still have the contract with the beast