1. For the pastry, mix the flour, polenta and a pinch of salt in a food processor.
Add the butter and pulse until the mixture resembles breadcrumbs.
2. Tip into a bowl; add 50g of the grated Parmesan and mix with a table knife until the mixture comes together.
3. Add the water a little at a time until the dough just sticks together (you may not need all the water). Knead it gently until it forms a ball, wrap the pastry in cling film and chill for 20 minutes in the fridge to allow the pastry to relax.
4. Preheat the oven to 200°C/fan180°C/ gas 6. Scatter the sliced butternut squash over 2 or 3 large roasting trays.
5. Drizzle with half the olive oil, sprinkle over the cumin seeds, paprika and season well with salt and coarse round or freshly milled black pepper. Roast in the oven, stirring occasionally, for 40 minutes or until tender but retaining its shape.
6. Add the sliced onions and garlic to another roasting tin with the rest of the olive oil and halfway through cooking the squash, roast the onions in the oven and for 20 minutes. Remove the squash and onions from the oven, squeeze out the garlic from their skins, and mash the roasted garlic into the onions and leave to cool slightly.
7. Heat a heavy bottom pan over medium heat and add the spinach, stirring continuously to wilt the leaves. Remove from the heat, cool, and then squeeze dry to remove all the excess water. Chop the spinach, put into a bowl, season and mix with the cream cheese, then set aside.
8. On a lightly floured surface, roll out two-thirds of the pastry and use it to line the base and sides of a 23cm spring form tin (the pastry will need to be handled carefully as it will be slightly brittle).
9. Add half the spinach mixture in a layer and then top with half the roasted squash on top of that. Sprinkle with half of the pine nuts, then half the goat’s cheese. Repeat with the rest of the spinach mixture, butternut squash, pine nuts and goat’s cheese. Finally, top with the cooked onions.
10. On a lightly floured surface, roll out the rest of the pastry, then lay on top of the pie, pushing in the edges to seal well. Make a hole in the middle of the pie and brush with beaten egg. Scatter with the rest of the Parmesan and chill for 20 minutes.
11. Bake for 30-35 minutes until the pastry is golden brown on top. Leave to cool in the tin for 10 minutes before serving and when ready remove from the tin and slice with a long serrated knife.