Cut off the end of the bulb of garlic, exposing all of the cloves, and drizzle with 2 tablespoons of the EVOO and season with salt and pepper. Wrap the bulb in foil to form a pouch, and roast until soft and sweet, 40 to 45 minutes.
Drizzle 4 tablespoons of the EVOO on a nonstick baking sheet. Halve the eggplant and score with sharp paring knife to crosshatch the flesh. Season with salt and pepper and set into the oil, with the skin-side up. Roast until tender, 30 minutes, and then cool to handle.
Char the red pepper over open flame on the stovetop or under the broiler. Cool in a covered bowl to handle, then peel and seed.
Heat 2 tablespoons EVOO, 2 turns of the pan, in small Dutch oven over medium heat, add the onions and some salt and pepper and cook, partially covered, 10 to 12 minutes. Add the tomatoes and the basil. Break up the tomatoes and simmer 25 to 30 minutes over low heat.
Heat a pot of water to boil. Cook the pasta until a little shy of al dente, 5 to 6 minutes. Reserve 1/2 cup of the starchy cooking water.
Scrape the eggplant away from skin into the food processor. Squish the garlic away from the skins and add to processor along with tomatoes and onions, ricotta and roasted peppers. Puree the sauce until smooth and creamy.
Drain the pasta and pour back into the hot pot. Add the sauce and the reserved pasta water. Toss to combine and adjust the seasoning. Pour into a casserole dish, top with the Parmigiano-Reggiano and pecorino. Cool completely and store in the refrigerator for a make-ahead meal.
To serve, bring the casserole to room temp and bake at 375 degrees F until brown and bubbly.
When blending hot liquid, first let it cool for five minutes or so, then transfer it to a blender, filling only halfway. Put the lid on, leaving one corner open. Cover the lid with a kitchen towel to catch splatters, and pulse until smooth.