Heat the oven to 200 C / 400 F with a rack in the middle. Peel the shallots, trim the tops, and halve them lengthwise, keeping the roots attached. Dust the counter with flour, roll the pastry just enough to cut a 27 cm / 10.5-inch round, and chill the round on parchment until needed.
Set a 25 cm / 10-inch oven-safe skillet over medium heat. Melt the butter with the sugar, stirring, for 3 to 4 minutes until the sugar dissolves and the mixture turns light amber. Add the balsamic vinegar, which will sputter, and the 4 thyme sprigs, then simmer for 1 minute.
Arrange the shallots cut side down in a tight single layer and season with the salt and pepper. Cook for 8 to 10 minutes without stirring, spooning syrup over the tops, until the cut sides are deep golden and the syrup coats the back of a spoon. If liquid still pools around the shallots, keep cooking. Remove from the heat and pull out the thyme sprigs.
Lay the cold pastry round over the shallots. Tuck the edges down inside the skillet wall with a spoon, then pierce the pastry 5 or 6 times with the tip of a knife.
Set the skillet on a rimmed sheet pan, 33 x 46 cm / 13 x 18 inch, to catch drips. Bake for 30 minutes, until the pastry is puffed and deep golden brown and the syrup bubbles thickly at the edges.
Rest the skillet on a rack for 10 minutes. Run a knife around the edge, set a 28 cm / 11-inch rimmed plate over the skillet, and flip in one motion using oven mitts, no later than 15 minutes after the skillet leaves the oven. Lift off the skillet and nudge any stuck shallots back into place.
Scatter the thyme leaves, goat cheese, and flaky salt over the top. Cut into 6 wedges and serve warm.