When both of them first cast it, the Moon was shining brightly but then the light subsided.
Then Madara came down to hunt Team 7. At that moment, if the moonlight was already absent then why didn't the once caught into the infinite Tsukuyomi escape out in the absence of the moonlight?
Same goes for Kaguya...why did she wake up some of the people that were caught in the infinite tsukuyomi and erase their memory when from the starting she wanted to use infinite Tsukuyomi to put mankind under a genjutsu?
When the moonlight stopped shining, shouldn't all the people in both cases escape out of the genjutsu?