Bring a large pot of salted water to a boil. Add 8 ounces of your favorite pasta—spaghetti or fettuccine work wonderfully. Cook according to package instructions until al dente. Reserve about 1/2 cup of pasta water before draining. Set pasta aside and keep warm.
Heat 2 tablespoons of olive oil in a large skillet over medium-low heat. Add the thinly sliced onion along with 1/2 teaspoon salt. Stir occasionally and cook slowly for about 20-25 minutes until the onions turn golden brown and sweetly caramelized.
Increase the heat to medium. Add the sliced mushrooms to the caramelized onions. Cook for about 5-7 minutes, stirring occasionally, until the mushrooms release their moisture and become tender and browned.
Stir in the minced garlic, 1/4 teaspoon black pepper, and optional 1/4 teaspoon red pepper flakes. Cook for 1-2 minutes until fragrant, being careful not to burn the garlic.
Pour in 1/4 cup vegetable or chicken broth and 1 tablespoon balsamic vinegar to deglaze the pan. Scrape up any browned bits from the bottom of the pan. Let the liquid reduce slightly, creating a flavorful sauce that will coat your pasta beautifully.
Add the cooked pasta directly into the skillet with the caramelized onion and mushroom mixture. Toss well to combine, adding reserved pasta water a little at a time if the mixture seems dry. Stir in 1/4 cup grated Parmesan cheese to bring everything together with a silky finish.
Transfer the pasta to serving plates or bowls. Sprinkle generously with fresh chopped parsley for a pop of color and freshness. Serve immediately.