First, make the pastry. Add both flours to the bowl of a food processor and pulse to mix the flour thoroughly. Add the cold butter to the flour along with a pinch of salt and the caraway seeds. Pulse again until the mixture resembles fine breadcrumbs. Add 6 tablespoons very cold water and pulse again. Continue to pulse until the mixture comes together into a ball. Add an additional tablespoon of water, if needed, but be patient and try to get there without. Turn the pastry out onto a lightly floured surface. Knead briefly and wrap in cling film. Refrigerate the pastry for at least 2 hours while you make the filling.
Heat the oil in a large saucepan over a medium heat. Add the onions and adjust the heat so they fry gently until caramelized and gooey (this should take around30 minutes). Keep an eye on them and stir occasionally to ensure even cooking. When the onions look sweet and delicious, turn up the heat, add a pinch of salt, the balsamic vinegar and pickle brine. Scrape the pan to pick up any of the tasty cooked bits, allow the liquid to bubble merrily until it’s sticky and delicious, then remove from the heat. Allow the onion mix to cool until needed.
Meanwhile, add the ricotta to another bowl. Grate the hard goat’s cheese into the ricotta and whisk to combine. Add half the thyme leaves and season with lots of cracked black pepper. Whisk again and set aside.
Once the pastry has chilled for at least 2 hours, and roll it out on a well floured surface to a large rectangle that is an even 3 mm/⅛ inch thick. Preheat the oven to 200°C/180°C fan/400°F/Gas 6 and line a large flat baking sheet with baking parchment. Cut the pastry into a 30-cm/12-inch disk and carefully lift onto the baking sheet. Leaving a clear border around the edge, spread the onion mixture evenly acrossthe pastry. Next, add spoonfuls of the ricotta mixture and small slices of the soft goat’s cheese. Arrange the beetroot over the cheese. Carefully fold inwards andcrimp the lip of pastry to form a ridged edge. Whisk the egg and brush across the pastry. Scatter the remaining thyme leaves over the top of the tart. Bake in theoven for 40 minutes until the pastry is a deep, even brown. If the pastry still looks pale after 40 minutes, give it an extra 10 minutes, but take it out of the oven as soon as it looks like it might be catching.
Remove from the oven and top with an extra grating of hard goat’s cheese. Serve immediately while warm or serve at room temperature with a crisp green salad.