First, make the pastry. Tip the flour, cheese and a pinch of salt into a large bowl and mix. Add the butter and rub it in using your fingertips until the mixture resembles breadcrumbs. Mix in 4-5 tbsp cold water, and bring together into a dough. Wrap and chill for 30 mins.
To make the filling, melt the butter in a medium saucepan over a medium heat, then add the oil and onions and cook for 10-15 mins until caramelised. Add the thyme and fry for 1 min more. Tip in the flour, and stir to combine. Gradually stir in the stock, adding it in small amounts to prevent lumps forming. Bring to a simmer and cook for 10 mins, stirring occasionally. Stir in the mustard and vinegar towards the end of the cooking time.
Meanwhile, put the potatoes in a large pan of cold water, bring to the boil and cook for 4-5 mins until just cooked and still holding their shape. Drain well, then stir into the sauce. Add the apples, cheddar and some seasoning, and stir again. Heat the oven to 200C/180C fan/gas 6.
Pour the filling into a 28cm oval baking dish (ours was 28 x 18.5 x 6.5cm). While it cools, roll out the pastry on a surface lightly dusted with flour to the thickness of a £1 coin. Cut into strips roughly 1cm wide. Lay half the strips across the dish horizontally, leaving gaps of a few millimetres in-between, then, one by one, weave in the remaining strips vertically, using an over and under technique, also spacing them apart by a few millimetres. Re-roll any trimmings and cut into flowers, leaves, or other shapes to decorate, if you like (see tip, below). Arrange any pastry shapes on top, then brush with the beaten egg.
Bake for 50 mins, keeping an eye on it – you may need to cover the top with foil if it’s starting to brown too quickly. Leave to cool for at least 10 mins before serving.