Heat a skillet over medium heat (no oil). Add the mushrooms and sauté for 5–6 minutes, or until tender and moisture has evaporated. Transfer to a plate and set aside.
In the same skillet, add olive oil and butter. Turn the heat to medium-high, add onions, and sauté for 5 minutes. Stir in the thyme leaves, then reduce heat to medium and continue cooking for about 20 minutes, stirring occasionally, until onions are caramelized. Season with salt to taste. Transfer to a plate and let cool.
Preheat oven to 400° and line a baking sheet with parchment paper. On a well floured surface, roll out puff pastry dough into a rectangle and transfer it to the prepared baking sheet.
Using a knife, score a ¾-inch border around the edges of the dough (be careful not to cut all the way through). Prick the center of the dough with a fork, leaving the border untouched.
Spread the caramelized onions evenly inside the border. Sprinkle half of the shredded cheese on top, then arrange the sautéed mushrooms over the onions. Top with the remaining cheese and, if desired, garnish with a few thyme sprigs.
Brush the edges of the pastry with the egg wash. Bake for 18–20 minutes, or until the tart edges are puffed and golden brown.
Let the tart cool for a few minutes before slicing. Serve warm.