What kind of mechanisms are at work to cause creative thinking or revelations during auto-pilot tasks like taking a shower or teeth brushing?

This describes it:

Incubation period - we are working on a problem, we can’t solve the task, we leave it aside for some period of time—the incubation period—and when we return attention to the task we have some new insight that helps us to solve the problem. In general, there are two frequently used methods to conduct incubation experiments. In the “interpolated activity” method, participants work on a task or problem for a period of time, are then given an incubation period, and finally return to the task. - https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3990058/