01 - Combine flour and salt in a large bowl. Cut in cold butter until mixture resembles coarse crumbs. Add egg and 2-3 tablespoons cold water, mixing until a soft dough forms. Shape into a disk, wrap in plastic, and refrigerate for 30 minutes.
02 - Preheat oven to 375°F. Roll chilled dough on a floured surface to fit a 9-inch tart or pie pan. Press dough into pan, trim excess edges, and prick base with a fork. Refrigerate until ready to fill.
03 - Melt butter in a large skillet over medium heat. Add diced bacon and cook until crisp, about 5 minutes. Remove bacon and set aside. Add sliced onions to the pan and cook gently, stirring frequently, for 15-20 minutes until golden and very soft. Stir in caraway seeds, salt, pepper, and nutmeg. Remove from heat and fold in cooked bacon.
04 - Whisk together heavy cream, whole milk, eggs, and grated cheese in a medium bowl until completely smooth and well combined.
05 - Spread the caramelized onion mixture evenly over the chilled pastry crust. Pour the custard mixture over the onions, ensuring even distribution.
06 - Bake for 40-45 minutes until the filling is set and the top is lightly golden. The center should still have a slight jiggle but not be liquid. Let cool for 10 minutes before slicing.
07 - Serve warm or at room temperature. Pairs beautifully with a crisp German Riesling, a fresh green salad, or tangy sauerkraut.