In a large Dutch oven or heavy pot, melt the butter over medium heat. Add the onions and salt, and cook, stirring frequently, until tender and golden brown, about 30 minutes. Add the sugar, reduce the heat to medium low, and cook, stirring frequently, for another 10 minutes. Keep a close eye on the heat, and lower it a bit if the bottom of the pan starts to burn. Cook until the onions are very soft and nicely browned. Taste and adjust the seasoning. Let cool.
Preheat oven to 450°F. Sprinkle the cornmeal on a rimmed baking sheet (you can line it with parchment first if you like). Roll out the dough to a half-inch rectangle or circle, letting it rests in between short rolling sessions. Place the dough on the baking sheet. Brush the dough with the olive oil, going all the way to the edges.
Spread the onions over dough, leaving a ½-inch border. Sprinkle the anchovies over, if using, then top the onions with the slices of tomato, overlapping them slightly. Sprinkle with the thyme and season with salt and pepper. Bake until the crust is golden brown and when a spatula is slid under the tart it lifts up firmly, about 15 to 18 minutes.
Sprinkle with torn fresh basil leaves and serve warm or at room temperature.
Notes
Most tomato pies, especially those popular in the southern part of the U.S., are made with fresh tomatoes, but using pie crust. What is known as Italian tomato pie is often pizza or focaccia dough topped with tomato sauce, but not fresh tomatoes. This is kind of like a hybrid between the two thoughts!