The Infinite Tsukuyomi does not affect Hashirama, Tobirama, Hiruzen and Minato because they are reanimated. Hagoromo, the Sage of the Six Paths, appears and explains to the four that Hashirama and Madara are the reincarnations of his sons Ashura and Indra. Hagoromo recounts the tale of how he founded Ninshu, the Ninja Creed, and about the lives of Ashura and Indra.
I sent the Tailed Beasts that had been
inside me to their respective lands.
أرسلتُ البيجو الذين كانوا بداخلي إلى أماكنهم المُحدّدة
entsandte ich die Bijuu
in die für sie erwählten Länder
repartí entre sus pueblos los Bijuu
que llevaba en mi interior,
repartí entre sus pueblos los Bijuu
que llevaba en mi interior,
mandai i cercoteri, che finora
 avevano riposato dentro di me, nei luoghi prescelti.
eu mandei as Bestas de Caudas, que estavam
 dentro de mim, aos seus respectivos templos.