Heat butter in a large skillet over medium-low heat. Add sliced onions, salt, and sugar. Cook for 25-30 minutes, stirring occasionally, until onions are golden brown and caramelized.
Deglaze the pan with balsamic vinegar (if using), stirring to incorporate the flavors.
In a large pot, bring salted water to a boil. Cook pasta according to package instructions until al dente. Reserve ½ cup of pasta water before draining.
In the same skillet with the onions, add minced garlic and sauté for 1 minute until fragrant.
Reduce heat to low and stir in heavy cream. Let it simmer for 2 minutes.
Add Parmesan cheese, black pepper, and red pepper flakes (if using), stirring until the sauce is smooth.
Toss the cooked pasta into the sauce, adding reserved pasta water gradually until desired consistency is reached.
Serve immediately, garnished with fresh parsley and extra Parmesan cheese.