Infinite Tsukuyomi and the revival of Kaguya was all due to plot. It could have been prevented from the start.
1. Kakashi could have killed Obito immediately after he lost. But Minato came to stop him.
2. Obito could have just used his Rinne Tensei immediately instead of talking too much. BZ came for him and he failed, Madara was revived instead.
3. Naruto after being revived from "death" should have healed Obito, killed or do something against Black Zetsu and probably helped him crushed the Rinnegan. I don't understand why did Naruto left too soon, at least he should have given some strength to Obito who was too weakened, so that he could overcome Black Zetsu and stab his Rinnegan himself. If it was possible for him to "revive" Gai in a matter of just 2 seconds or so, then healing Obito shouldn't be a waste of time at all.
But people don't whine about these failures, it's only Sakura's fault right???