Cook the pasta according to the package instructions. Drain and set aside, reserving some pasta water.
In a large skillet, heat the olive oil over medium heat. Add the sliced onions and cook, stirring occasionally, until they become soft and golden brown, about 20 minutes.
Add the minced garlic to the skillet and cook for an additional 1–2 minutes until fragrant.
Pour in the balsamic vinegar and vegetable broth (or white wine) to deglaze the skillet, scraping up any browned bits from the bottom. Let the sauce simmer for 5 minutes until slightly reduced.
Season with salt and pepper to taste. If the sauce gets too thick, add a little reserved pasta water to reach the desired consistency.
Add the cooked pasta to the skillet and toss to coat in the sauce, allowing the pasta to absorb the caramelized onion flavor.
Sprinkle with grated Parmesan cheese and fresh thyme or basil, if desired, before serving.
Notes
For added richness, stir in a tablespoon of butter after the pasta is added to the sauce.