Is it the EVO position that early living beings with eyeballs may not have had eyelids, but after millions of years the the EVO-Code started saying to offspring "form something over your eyes to keep foreign objects out" or "form something over the eyes that will help us rest for 8 hours"?
It was probably more like what we are seeing as answers in this thread. Some kind of nictitating membrane, the ability to withdraw the eyes for protection and the like evolved first. There was no code to tell it to form something to keep objects out - those with better eye protection were better placed to take advantage of land resources for longer periods of time, increasing their fitness and increasing the ratio of beings with eye protection.
Until that point, vertebrates were limited to keeping close to water (either entirely aquatic or amphibious) where such things are less of a concern.