To make the dough, add water to the bowl of a standing electric mixer. Scatter yeast and a pinch of the sugar over the water’s surface. Stir to combine. Let stand until bubbly, about 5 minutes.
Meanwhile, melt butter in a small saucepan over medium heat. Remove from heat and add milk, the remaining 2 tablespoons sugar, and salt. Stir to combine. Add egg and mix well.
Add contents of the saucepan to the yeast mixture along with 2 cups of the flour. Beat with the paddle attachment until combined. Add remaining flour, about half a cup at a time, until a smooth but sticky dough forms. Switch to the dough hook and knead for 3 to 5 minutes.
Transfer the dough into a lightly oiled bowl, flipping it to coat the entire surface. Cover with plastic wrap and let rise until doubled in size, about 1 to 2 hours.
In the meantime, prepare the onions. Melt butter in a large skillet over medium heat. Add onions and a sprig of thyme and stir to combine. Cook, covered, until softened, about 20 minutes, lifting the lid occasionally to stir.
Remove lid and continue cooking, stirring occasionally, until onions are golden and any remaining liquid has evaporated. Mix in sherry and salt and cook, stirring, until the liquid evaporates. Remove thyme sprig and turn off heat. Strip about a tablespoon of fresh thyme leaves from remaining sprigs and mix them into the onions, along with salt and pepper to taste. Allow onions to cool while the dough rises.
Parchment-line two baking sheets. Turn the risen dough out on an unfloured surface and divide into 18 equal pieces. Shape pieces into balls and flatten them into disks that are thicker in the center.
Add 2 to 3 teaspoons of the onions and a cube of cheese into each round and pinch the dough tightly together at the bottom, working to shape each one into a tight ball.
Place rolls, pinched-side down on prepared baking sheets, spacing them at least 1 inch apart. Cover with plastic wrap and let rise again in a warm place for about 30 minutes.
Preheat oven to 375° F. Just before baking, brush the tops of the rolls with melted butter. Sprinkle fresh thyme leaves and salt over the tops.
Bake for 18 to 20 minutes, switching baking sheets halfway through baking, until the rolls are golden brown. Remove from the oven and cool for about 10 minutes before serving.
These rolls taste best warm from the oven, but they reheat well. Microwave individual rolls for about 20 seconds or wrap rolls in foil and warm in an oven heated to 350 degrees for about 7 to 10 minutes.