Bake the butternut pumpkin. If you're doing this ahead of time, just cut it into a few pieces, scoop out the seeds, and place on a baking tray and bake at moderate heat for an hour or so until soft, then remove the flesh from the skin. If you're in a hurry, skin and seed the pumpkin then cut into smallish cubes. Toss with a bit of olive oil, then bake at 350F for about 20-30 minutes until soft. Puree it with a potato masher or implement of choice.
Stir the polenta into the cold water in an ample pot, add the vegetable stock, and bring it to a simmer, stirring constantly. Continue stirring until the polenta is thick and tender, about half an hour. Remove from the heat, then stir in the pureed pumpkin and the butter, and add a little salt and pepper. Remember that you will be layering it with salty feta, so use a light hand. Pour the polenta onto a large baking sheet and smooth it into a 1/2 inch layer. Allow it to stiffen (30 minutes or more), then cut into rectangles about 2x3 inches in size.
Meanwhile, peel, halve and slice the red onions. Warm the oil in a large non-stick pan over a low-moderate heat. Add the onions and a dash of salt, and cover. Cook for about 15 minutes, stirring now and then, then remove the lid and cook another 15 minutes or more. When the onions are very soft, add the balsamic vinegar to taste and cook another 5 minutes, then remove from the heat and set aside.
Wipe and slice the mushrooms. Heat the butter or oil and cook the mushrooms until they're a lovely dark brown. Season with Salt and pepper and set aside.
Remove tough stems from the spinach and wash the leaves well, then chop roughly. In a large saucepan, heat a bit of oil and add the peeled and chopped garlic. Saute for a minute or two, then add the spinach. Put the lid on the pan, and cook for several minutes, turning the leaves with tongs every couple of minutes to stop them sticking. When the leaves are wilted and tender, remove them from the heat and tip them out into a large colander to drain any liquid.
In a bowl, mix together the spinach, mushrooms, onions and most of the crumbled feta. Lightly oil a large gratin or lasagne dish. Spoon a little of the vegetable mixture into one end of the dish, then start overlapping layers of the polenta slices with layers of the vegetable mixture, leaving some of the filling showing between layers of polenta. You'll have to judge how upright to layer the slices based on the size of your dish. Once you have used up all the filling and polenta, sprinkle the remaining cheese over the top. Bake at 350F for about 30 minutes. It should be bubbling hot, and the cheese on top will be golden brown in spots. Let it sit for 5 minutes, then serve.