Playing piano doesn't require analytical thinking either. Motor memory is just another set of patterns, and rest helps establish the patterns in our mind.
I feel I need a more detailed explanation here.
Apparently something gets depleted from the brain during the day, that we get back during sleep. Maybe it's structural, not chemical, but something gets depleted.
That's my take as a layman.
Otherwise I agree after sleep, what we learn seems more readily available.