The part about the ancestral environment is generally accepted wisdom here and is supported by lots of arguments scattered all over LW. Random example, we like to eat more than is good for us because this instinct made sense when times of feast alternated with times of famine. Another random example, boys are afraid to approach girls because we used to live in small tribes, so one botched attempt could seriously hurt our chances of ever reproducing.
Not everyone experiences random creativity just before falling asleep, but many people do, e.g. there are legends about Edison and Salvador Dali using it, and Coleridge apparently wrote Kubla Khan in this state. I've used it to write poems and music.
I think Coleridge was on laudanum, not sleepiness.
We operate like this: the "overseer process" tells the brain, using blunt instruments like chemicals, that we need to find something to eat, somewhere to sleep or someone to mate with. Then the brain follows orders. Unfortunately the orders we receive from the "overseer" are often wrong, even though they were right in the ancestral environment. It seems the easiest way to improve humans isn't to augment their brains - it's to send them better orders, e.g. using drugs. Here's a list of fantasy brain-affecting drugs that I would find useful, even though they don't seem to do anything complicated except affecting "overseer" chemistry:
1) A drug against unrequited love, aka "infatuation" or 'limerence".
2) A drug that makes you become restless and want to exercise.
3) A drug that puts you in the state of random creativity that you normally experience just before falling asleep.
4) A drug that puts you in the optimal PUA "state".
5) A drug that boosts your feeling of curiosity. Must be great for doing math or science.
Anything else?