The onions take some time to caramelize; they can be prepared up to a day in advance and refrigerated.
Melt butter in a large skillet over medium-low heat. Add onions; season with salt and pepper. Cook until onions begin to soften, stirring often, about 15 minutes.
Reduce heat to low and add sugar and thyme. Continue cooking, stirring occasionally, until onions are very soft and caramelized, about 1 1/4 hours.
Add Madeira; cook until liquid evaporates, about 1 minute. Raise heat to medium and cook for 5 minutes. Remove from heat and set onions aside in a small bowl.
Heat oven to 450 degrees. Sprinkle cornmeal evenly over a large baking sheet. Place dough on a lightly floured surface and carefully stretch to a 10-by-15-inch rectangle about 1/4 inch thick. Transfer to the baking sheet and pierce entire surface of dough with a fork. Scatter cheese evenly over dough and arrange onions on top.
Place pizza in the oven and bake until crust is golden brown and cheese is bubbling, about 20 to 25 minutes. Serve immediately or at room temperature. Garnish with sprigs of thyme, if desired.