Chapters 501-502 never give or imply any particular reason for why exactly Tobi/Obito would attack the village at that time. Certainly, the smartest strategic choice would have been to simply extract Kurama from Kushina and immediately run for it as far and fast as they could.
The most straightforward reason is simply: rage. The Uchiha are famous for their fury, once their blood starts boiling, and it may be he simply saw red so went on a rampage with the most devastating weapon he had on hand. Remember that he had just been to Rin's grave and seen Kakashi there, reviving all those old, tormented memories, and from there had to immediately battle Minato. Minato was probably the most powerful and wily opponent he'd ever faced until that point, so battling him must have been frustrating. The combination of these events in such quick succession: boom!