>>1263778That happens a lot. What you need to do to prevent it is to saturate the soil completely with water before planting. Let it drain so it isn't soupy, plant the seeds, place a humidity dome/tent over it, then only use a spray bottle of water to mist the top of the soil in order to water them. Once the seedlings have popped up, shed their husks, and have cotyledon that look fully developed you can remove the humidity dome/tent. Keep misting for a while, but switch to using a watering can with a soft sprinkle once the seedlings start making leaves. Of course, having them in direct sunlight with a humidity dome/tent is a no-no, unless it has some ventilation. It is still better to give them some shade while the humidity dome/tent is over them.
What you did to recover your seeds/seedlings is fine. For onions, it is okay for the bulb to form above ground and some gardeners do that purposely. The only thing you need to make sure of is that the roots themselves don't dry out at the surface and they are hidden from light. Sometimes the larger onions need support to keep them from toppling over and tearing their roots out of the ground.