Start by warming some olive oil in a large pot over medium heat. You want to see it shimmer gently, bringing a lovely aroma to your kitchen. Do not let it smoke, as that can give a bitter taste.
Add the diced onion and sliced garlic to the pot. Stir them up and let them sweat until they are soft and fragrant, which should take about 5 minutes. This gives your sauce a sweet depth. Be careful to not let the garlic brown, as it can turn bitter quickly.
Stir in the tomato paste along with optional red pepper flakes. Cook for about 2 minutes until it darkens slightly and smells incredible. This step deepens the flavor of the sauce, so do not skip it and keep an eye out to prevent burning.
Pour in the crushed plum tomatoes and season with salt and pepper. Stir well and let it simmer on low heat. You want to see bubbles here and there after about 15 minutes. Letting the flavors meld is key, so resist the urge to rush it.
In another pan, toss the eggplant cubes with olive oil, salt, and pepper. Roast them until they are soft and slightly caramelized, about 30-40 minutes at 400 degrees F. Your kitchen should smell roasted and savory. Do not under-roast, or they will remain tough.
Boil water in a large pot, then add your chosen pasta. Cook it for a couple of minutes shorter than the package directions recommend for al dente texture, as it will continue cooking in the oven. Avoid overcooking to prevent a mushy texture.
In a large baking dish, combine the pasta, roasted eggplant, sauce, chopped basil, and half of the mozzarella. It should feel hearty and vibrant. Be cautious not to overmix and break the pasta.
Spread the ricotta across the top and sprinkle with the remaining mozzarella and Pecorino Romano. You want a nice, cheesy topping that will melt beautifully. Go easy on mixing the cheese in, so you have lovely pockets of ricotta throughout.
Bake in the oven until it is bubbling and the cheese is golden brown, about 30 minutes. Your kitchen will smell divine. Keep an eye on it to avoid overcooking the top, which can dry out everything underneath.