Cook the pasta according to package instructions in a large pot of salted boiling water until al dente. Reserve 1/2 cup of pasta water, then drain the pasta and set aside.
In a large skillet, heat 2 tablespoons of olive oil over medium heat. Add the sliced onions and 1/2 teaspoon of salt. Cook, stirring occasionally, for about 20-25 minutes, or until the onions are deeply caramelized and golden brown.
Add the minced garlic and red pepper flakes to the skillet with the onions. Cook for an additional 2-3 minutes, stirring frequently, until the garlic is fragrant.
Add the cooked pasta to the skillet, along with the reserved pasta water and the remaining tablespoon of olive oil. Toss everything together until well combined. Season with black pepper and adjust salt if necessary.
If desired, sprinkle with grated Parmesan cheese and garnish with chopped parsley before serving.