Cook spaghetti separately according to package instructions until al dente. Drain and set aside.
Heat olive oil in a large skillet over medium heat. Sauté onion, garlic, carrots, and mushrooms until softened, about 5-7 minutes.
Add dried thyme, oregano, basil, and tomato paste. Stir continuously for 1 minute until fragrant.
Pour in red wine (or vegetable broth with balsamic vinegar). Cook until liquid reduces by half, about 2-3 minutes.
Add red lentils and marinara sauce. Bring to a simmer and cook for 15–20 minutes until lentils are tender and sauce has thickened.
Season with salt, black pepper, and red pepper flakes to taste.
Serve sauce over cooked spaghetti and garnish with fresh basil.