To make the pastry, sieve the flour and xanthan gum into a bowl, then add 1 teaspoon of sea salt.
Place the butter and 150ml water into a small pan over a low heat and bring to the boil, then set aside to cool slightly.
Beat the egg, then stir into the flour mixture with the warm butter until it comes together into a rough dough. Bring it together with your hands, then cover and leave to rest while you make the filling.
Preheat the oven to 180ºC/350ºF/gas 4.
Peel and finely slice the onions, then add to a medium pan over a medium heat with a drizzle of olive oil, the rogan josh paste, cumin seeds and chilli flakes.
Peel and crush in the garlic, then fry for around 10 minutes, or until golden and smelling delicious. Stir in the tomato purée and cook for a further minute, then add the spinach and stock. Cook for a further 5 minutes, or until thickened and reduced.
Remove the pan from the heat. Mash the cooked veg, then stir it into the pan. Grate in the cheese, stir well, then season to taste. Spoon the mixture into a pie dish (roughly 20cm), spreading it out evenly.
On a lightly floured surface, roll out the pastry to roughly ½cm thick (if you find it crumbles too much, roll it out between two large pieces of clingfilm).
Beat the egg, then brush it around the edges of the pie dish. Carefully place the pastry on top, trim away any scruffy edges, then pinch the edges to seal.
Score a cross in the middle, use any extra bits of pastry to decorate the top, then brush over more egg.
Place the pie dish on a baking tray, then pop in the hot oven for 30 to 35 minutes, or until golden and piping hot through, brushing over more egg halfway through cooking. Delicious served with gravy and steamed greens.