Board Thread:Naruto Discussions/@comment-24531362-20140904111518/@comment-1512913-20140909111835

He was watching Naruto and Sasuke battle Kaguya before he came out of Madara's bottom, thus figured it out.