The “end of day” routine happens no matter where you are on the surface once the countdown hits 0. If the countdown starts you cannot enter a cave. If a pikmin is not embedded in the ground to be plucked, inside the light signal emitted by the onion, or counted as a part of your or oatchi’s squad, you’ll take off without them and get to watch them panic and shriek in terror as the planet’s nocturnal predators eventually get them; the game essentially kills them all instantly