Make the tart crust: In the bowl of a food processor, mix the flours, salt, and thyme to combine. Add the butter and pulse until it’s slightly smaller than the size of peas. Add the water gradually, pulsing until the dough forms a ball around the blade. The dough shouldn’t be sticky to the touch, but it should hold together well. Form the dough into a rough rectangle about 1/2-inch thick and wrap in plastic wrap. Chill for 30 to 45 minutes.
In a large sauté pan, heat the butter and oil over medium heat. Add the onions and toss to coat. Reduce the heat to low and cook, stirring occasionally, until the onions are deeply golden and caramelized, 30 to 40 minutes. Season with salt, pepper, and red pepper flakes. Add the mushrooms to the pan and cook, tossing occasionally, just until they release their moisture, 3 to 4 minutes. Cool the mixture to room temperature.
Preheat the oven to 400° F. On a lightly floured surface, roll out the dough to 1/4-inch thick. Try to maintain a long rectangle shape while rolling if you’re planning to use the rectangular pan. Otherwise, try to keep it in an even circle. Roll the dough up onto the rolling pin, and drape gently over the tart crust.
Work around the tart, lifting the dough up slightly where it meets the edge and then gently nudging it down: You’re trying to get the dough to be flush with the pan, even in the corners. Chill the dough inside the pan for 10 to 15 minutes.
Trim the excess dough away from the edge of the tart pan. Place a piece of parchment in the center of the tart and fill with pie weights. Par-bake the crust until it just begins to turn golden at the edges, 12 to 15 minutes. Cool to room temperature. Reduce the oven temperature to 375° F.
Spread the onion mixture in an even layer inside the tart pan. Cover the entire surface of the tart generously with the cheese. Return the tart to the oven and bake until the crust is golden brown, the cheese is golden, and the mushrooms are very tender, 17 to 20 minutes. The tart can be served warm or at room temperature. Cool at least 15 minutes before slicing and serving.
I always carry three kinds of hot sauce in my purse. I have a soft spot for making people their favorite dessert, especially if it's pie. My first cookbook, The Fearless Baker, is out on October 24, 2017.