There's a plausible hypothesis that sleep is the thing that evolved precisely to stop us doing things for any more time than is strictly necessary. That is, sleeping is safe.
I don’t think any serious biologists agree with it. There is a hard physiological need to repair cellular damage from metabolism, UV (this a big deal in unicellular species), etc. If this theory was correct, and it is possible to do it entirely while awake, there would be species (apex predators in particular) that would have evolved without the need for it, like everything that is not a hard requirement. But this is not the case.
There must far more to it than that. As soon as sleep is a thing, it can be optimised for different goals. Since animals have widely varying sleep requirements, there's clearly some evolutionary factor that influences sleep length.
That is, though sleep might have physiological requirements, it doesn't mean that the amount of sleep is not influenced by non physiological effects.
I'm constantly amazed by the ability of biologists to be amazed by the reach and ingenuity of evolution.
Yes, but evolution didn't account for the need for those TPS reports to be ready by tomorrow morning and Bob over there is already 48 hours into his shift (don't worry he's on salary, the overtime is free).