Preheat your oven to 425°F (220°C).
Cut the eggplants into 1-inch cubes. In a bowl, toss the eggplant cubes with 2 tablespoons of olive oil, salt, and black pepper until well coated. Spread the eggplant evenly on a baking tray.
Roast the eggplants in the preheated oven for about 25 minutes, stirring halfway through to ensure even cooking.
While the eggplant is roasting, bring a large pot of salted water to a boil. Add the pasta and cook according to package instructions until al dente. Drain and set aside, reserving about ½ cup of pasta water.
In a large skillet, heat the remaining 2 tablespoons of olive oil over medium heat. Add minced garlic and red pepper flakes, sauté for about 1 minute until fragrant.
Stir in the canned diced tomatoes, letting the mixture simmer for about 5 minutes. Add reserved pasta water if the sauce is too thick.
Add the roasted eggplants and cooked pasta to the sauce, tossing everything together. Adjust seasoning with additional salt and pepper if needed.
Remove the pan from heat and stir in the grated Parmesan cheese until well combined.
Serve in bowls, garnished with fresh basil and additional Parmesan cheese if desired.