1/4 cup grated Parmesan cheese, plus more for garnish
Heat 2 tablespoons olive oil in a skillet over medium heat. Cook and stir onion, mushrooms, and garlic in hot oil until onion is translucent, 5 to 7 minutes.
Bring a large pot of lightly salted water to a boil; add about 1 teaspoon olive oil to keep spaghetti from sticking. Cook spaghetti in the boiling water, stirring occasionally, until cooked through but firm to the bite, about 12 minutes. Drain and transfer hot spaghetti back to pot.
Stir eggs into spaghetti; allow heat from spaghetti to cook the eggs. Stir onion and mushroom mixture and 1/4 cup Parmesan cheese into spaghetti over low heat until eggs are fully cooked and cheese is melted. Garnish with additional Parmesan cheese.