Preheat oven to 450 degrees. Line a baking sheet with parchment paper.
Combine the Pecorino Romano and Parmesan cheese in a small bowl and set aside.
Toss the eggplant with 2 tablespoons olive oil, 1 teaspoon salt, and ½ teaspoon pepper. Spread in an even layer on the prepared baking sheet. Roast for 15 minutes, flip the eggplant, then roast for another 10 minutes.
Bring a large pot of salted water to a boil, add the spaghetti, and cook until al dente, 8 – 10 minutes. Reserve some of the pasta water. Drain the pasta.
Meanwhile, make the sauce and boil the pasta. Heat 2 tablespoons olive oil in a large skillet over medium-high heat. Add the garlic and red pepper flakes. Cook, stirring for 30 – 60 seconds. Add the tomatoes and their juices, the oregano, sugar, 1 teaspoon salt, and ½ teaspoon pepper. Reduce heat to medium-low and cook, mashing up the tomatoes, for 15 – 20 minutes.
When the eggplant is done, stir into the sauce with the chopped basil. Add the spaghetti to the sauce with ¾ of the cheese mixture and stir gently. Add some of the reserved pasta water to thin the sauce if needed.
Divide the spaghetti between 4 shallow bowls, top with the remaining cheese mixture, some torn basil leaves, and a drizzle of olive oil.