Preheat oven to 180˚C / 350˚F. Place the oats and pecan or walnuts onto a baking sheet and place in the oven and toast until fragrant, about 8 -10 minutes. Watch them closely to make sure they don’t burn. Leave the oven on.
Place the oats and toasted nuts into a blender or food processor and pulse until the ground to resemble crumbs or wet sand. Transfer the crumbs in into a large bowl and add the brown sugar, sea salt and if using, the nutmeg and thyme leaves. Stir to combine. Add the butter and stir until the crumbs are well coated.
Grease a 9-inch, loose bottomed pie tin with non-stick cooking spray. Transfer the crumbs to the pie tin and press it evenly across the bottom and about 1 inch up the sides, tidying the top of the sides as much as possible. Place into the oven and bake for 10 minutes. Remove from the oven and leave to cool on a baking sheet, ready for filling. Leave the oven on.
Meanwhile, place the pumpkin / winter squash (or canned pumpkin puree) into a blender and add the silken tofu, milk, cornflour (cornstarch) and rice flour. Puree until it is completely smooth. Add the cheese, season with about 1 teaspoon of sea salt and lots of black pepper and stir to combine. Pour the mixture into the cooled pie shell, smoothing the top. Bake until the filling is set around the edges with a slightly jiggle in the centre, 35-40 minutes.
Cool completely before transferring to the fridge to chill for at least 3 hours, preferably overnight.
To make the caramelized onions: Heat a large frying pan / skillet on medium heat. Add 2 - 3 tablespoons olive oil, the onions and a pinch of sea salt. Cook, stirring occasionally, reducing the heat to medium low if the onions start to burn too quickly, until the onions are soft, sweet and caramelized, about 45 - 50 minutes.
When ready to serve, top with the caramelized onions, if using, more grated gruyere and chives.