Preheat oven to 375°F (190°C) and lightly grease a 9x13 inch baking dish with olive oil or cooking spray.
Boil spaghetti in salted water 2 minutes less than package directions (until firmly al dente). Reserve ½ cup pasta water, then drain and toss with olive oil to prevent sticking.
Sauté onion in olive oil over medium-high heat until soft, 3-4 minutes. Add garlic and cook 30 seconds until fragrant. Add mushrooms and cook undisturbed 2-3 minutes, then continue 5-7 minutes until liquid evaporates.
Add bell peppers and cook 3-4 minutes until slightly softened. Season with Italian seasoning, basil, oregano, red pepper flakes, salt, and pepper.
Pour marinara sauce and crushed tomatoes into the skillet. Simmer 5 minutes, stirring occasionally, until thickened slightly. Adjust seasoning to taste.
Mix ricotta, egg, Parmesan, salt, and pepper in a medium bowl until smooth and well combined.
Combine drained spaghetti with two-thirds of the sauce in a large bowl, tossing until fully coated.
Spread half the sauced spaghetti into the prepared baking dish. Top with ricotta mixture, then ½ cup mozzarella. Add remaining spaghetti, then spoon remaining sauce over top and sprinkle with remaining 1½ cups mozzarella.
Cover with foil and bake 20 minutes. Remove foil and bake 15-20 minutes more until cheese is bubbly and golden at the edges. Broil 2-3 minutes for extra color if desired.
Rest 10 minutes before slicing. Garnish with parsley and fresh basil, then serve.