Bring a large pot of salted water to a boil. Cook the spaghetti according to package directions. Reserve 1/2 cup of pasta water before draining.
While pasta is cooking, heat olive oil and butter in a large skillet over medium heat.
Add the diced onion and sauté for 3–4 minutes until soft and translucent.
Stir in the garlic, peas, and mushrooms (if using). Cook for another 2–3 minutes until fragrant and softened.
In a small bowl, whisk together the eggs, grated Parmesan, black pepper, and nutritional yeast (if using). Set aside.
Reduce the skillet heat to low. Add the cooked spaghetti and toss with the veggies.
Remove the pan from heat. Slowly pour in the egg mixture while stirring constantly to create a creamy sauce.
Add reserved pasta water a bit at a time to loosen the sauce as needed. Stir until glossy and smooth.
Taste and adjust with salt or more pepper as needed. Serve hot with extra cheese on top if desired.