On the evolution of thermally stratified layers at the top of Earth's core