The big clue is in Kawaki’s speech. Kawaki said that the age of ninjas is over. The Ōtsutsuki clan members aren’t ninjas. They either belong to another dimension or some other planet.
So, maybe Sasuke found about another threat on his travels and informed Naruto about it. Thus, Naruto must’ve left the village to check on it and Kawaki attacked the village during the same time.
That’s it from me. I hope you enjoyed it. Please leave your opinions about this theory below.