In a heavy pot, bring 6 cups water and 1 tsp salt to a boil. Gradually stir in polenta, stirring quickly to avoid lumps. Turn heat to low. When water is completely absorbed, add another 1/2 cup of water and continue to stir occasionally. Continue adding water, 1/2 cup at a time, after each time water is absorbed by polenta. Continue to cook for at least 30 minutes, stirring occasionally. Stir in butter last.
While polenta cooks, in a wide saute pan over medium heat, heat 1 tbsp olive oil. Add the onions and stir to coat the onions in oil. Season with 1 tsp salt and pepper to taste. Continue to cook over medium low heat until onions are golden and caramelized, stirring occasionally, about 20 minutes. Transfer onions to a bowl and set aside.
Heat remaining tablespoon of oil in the same pan. Add the mushrooms and garlic and cook until mushrooms release their liquid and then evaporates. Add spinach and stir together until spinach is just wilted. Return onions to pan and stir to combine.
Spread the polenta on the bottom of a lightly oiled 9×13 baking dish. Arrange mushrooms, greens, and onions over the polenta. Dollop mounds of ricotta and slices of goat cheese over the vegetable mixture.
Bake for 20 minutes until cheese is melted and soft. Sprinkle with fresh thyme leaves to serve.