Heat a large cast-iron skillet over high heat until smoking. Add the tomatoes to the dry pan and cook, turning a few times, until charred on all sides but still holding their shape, 3 to 4 minutes. Add the onions and then immediately pour in the vinegar. Stir in the confectioners' sugar until dissolved. Cook, stirring often, until the onions soften and the vinegar thickens, 3 to 5 minutes. (The onions should retain some bite; the vinegar should be reduced and be slightly syrupy.) Pour into a serving bowl, making sure to scrape out all the contents of the skillet. Season with the flaky sea salt and drizzle olive oil over the top. Garnish with the basil.