Preheat oven to 180°C/350°F (160°C/320°F fan).
On medium heat, heat olive oil in a pan. Add the mushrooms, season with salt and pepper, and cook stirring occasionally until the mushrooms release their liquids and it cooks off (about 8 minutes).
Melt butter (optional)*, and saute garlic until its fragrant. Add thyme, cook for a minute, and remove from heat.
Line a baking sheet with parchment paper, this will prevent the puff pastry from sticking to the sheet pan. Unroll the puff pastry sheet, then score the edges using a sharp knife leaving a 1-inch border. Then using a fork, prick the puff pastry sheet.
Top the puff pastry with grated cheese, followed by sauteed mushrooms.
Using a pastry brush, brush the border with an egg wash.
Bake for 12-15 minutes, or until the puff pastry is puffed and lightly browned.
Sprinkle some chili flakes if desired, then cut into 6 squares, and serve warm.