01 - In a large bowl, whisk together flour and salt. Add cold butter and cut in using a pastry cutter or fingertips until mixture resembles coarse crumbs. Gradually add ice water until the dough just comes together. Shape into a disk, wrap, and chill for at least 30 minutes.
02 - Heat olive oil and butter in a large skillet over medium heat. Add onions and cook, stirring frequently, until they are soft and golden, about 12 minutes. Stir in garlic and cook for 1 minute. Add mushrooms, thyme, salt, and pepper; cook until mushrooms are tender and moisture evaporates, about 8 to 10 minutes. Remove from heat and let cool slightly.
03 - Preheat oven to 400°F and line a baking sheet with parchment paper.
04 - On a lightly floured surface, roll chilled dough into a 12-inch circle. Transfer the dough to the prepared baking sheet.
05 - Spread the mushroom and onion filling over the center of the dough, leaving a 2-inch border. Sprinkle with Gruyère cheese and parsley if desired.
06 - Fold the pastry edges over the filling, pleating as needed to form a rustic border, leaving the center exposed. Brush the crust with the egg wash.
07 - Bake for 30 to 35 minutes until the crust is golden and crisp. Allow to cool for 5 minutes before slicing and serving.