Sprinkle all sides of eggplant with salt; let rest to release moisture, about 30 minutes. Rinse off the salt. Make deep, crisscross cuts through the eggplant flesh, leaving the skin intact.
Place eggplant and zucchini on a baking sheet; drizzle with 2 tablespoons olive oil.
Place chicken thighs in a baking dish. Combine 1 1/2 tablespoons olive oil and balsamic vinegar in a bowl and drizzle over chicken. Cover with aluminum foil.
Bake vegetables and chicken in the preheated oven until zucchini is tender, about 12 minutes. Remove the zucchini; continue baking until eggplant is soft and and chicken juices run clear, 13 to 17 minutes more. An instant-read thermometer inserted near the bone should read 165 degrees F (74 degrees C).
Heat the remaining olive oil in a saucepan over medium heat. Cook onions and garlic until onions are translucent, about 5 minutes. Add tomato sauce, basil, and pepper. Bring sauce to a boil. Cover; let simmer until flavors meld, about 30 minutes.
Bring a large pot of lightly salted water to a boil. Cook spaghetti in the boiling water, stirring occasionally, until tender yet firm to the bite, about 12 minutes. Drain. Pour sauce over the spaghetti. Place the chicken, eggplant, and zucchini on top.