The main reason to why tobi ( Obito) didn't attack the leaf was because Of sasuke uchiha.
Obito knows the secret's of the Sharingan and all it's upgrades from madara. Obito's main goal was to have Nagato revive Madara with the rinnegan and then they could continue thier Moon's Eye plan. But obito had a back up plan If his oringinal plan had failed which it did when nagato revived the leaf village instead of using it to revive madara. So Obito had his eye's on Sasuke as the one who could unlock and awaken the Rinnegan due to him having a brother meaning the he can take his brother's (itachi) and awaken the Eternal Mankeyou Sharingan. Also he wanted sasuke to continue his work had obito died.
Obito's plan was to Keep itachi alive and have him fight sasuke to awaken his Ms/EMS. With Sasuke having the EMS, Obito will then Inject Sasuke with senju DNA and thus awakening the Rinngan so Sasuke can revive madara and continue the moon's Eye plan.
Obito knew that once Itachi let's sasuke kill him and awaken his Ms, Obito would then tell sasuke the truth about itachi and have sasuke implant the EMS and he will be one step closer to awakening the Rinnegan for the Moon's Eye Plan. The proof of this is when Tobi wanted to connect sasuke to the gedo mazou to somehow revive madara.
So in my conclusion, Obito did not kill itachi off because he needed sasuke to do , so Sasuke can further progress his Sharingan. Obito attacked the leaf village after itachi died because sasuke already awakened the Ms and later on will want to transplant his brother's eyes. Obito didn't want to attack the leaf while itachi was still alive was because he knew that itachi would try to stop him and obito would of had to kill itachi and thus ruining his plan for sasuke to join him and further progress their plan.