How to Make It
Heat butter and olive oil in a heavy-bottomed saucepan over medium until butter is melted. Add sliced onions all at once; stir to coat. Cook, undisturbed, until onions begin to soften, about 4 minutes. Add thyme, mustard, pepper, salt, and sugar; stir to combine. Cook, covered, stirring every 4 minutes, until onions begin to brown, break down, and resemble onion jam, about 16 minutes. Reduce heat if onions begin to brown too quickly.
Add chicken stock to pan. Cook, stirring constantly with a wooden spoon to loosen browned bits from bottom of pan, until liquid evaporates, about 30 seconds. Remove pan from heat, and let stand while pastry bites are assembled.
Preheat oven to 375°F with rack in upper third of oven. Unfold thawed puff pastry on a lightly floured work surface. Use a rolling pin to roll out 1 sheet, creating a 10-inch square. Repeat with second sheet.
Spoon 25 dollops (about 1 teaspoon each) of onion filling about 1 inch apart on 1 of the pastry sheet squares (5 individual teaspoons on each of 5 horizontal rows and 5 teaspoons on each of 5 vertical rows). Top each teaspoon of onion filling with a pinch of shredded Gruyère.
Carefully place remaining pastry sheet square on top of onion- and cheese-topped square. Gently press pastry around onion-and-cheese filling to seal. Use a pizza cutter to slice into 25 pastry bites. Use a fork to press edges of each to seal in filling
Place pastry bites about 2 inches apart on a baking sheet lined with parchment paper. Lightly brush each with egg, and sprinkle with salt and pepper.
Bake in preheated oven until golden brown and puffed, 12 to 15 minutes. Remove from oven; let cool 15 minutes before serving. (Unbaked bites can be made ahead, covered, and refrigerated up to 2 days or frozen up to 2 weeks ahead; bake at 375°F for 15 to 20 minutes.) Serve the puff pastry bites with Dijon and grainy mustards on the side for dipping.