Heat olive oil in a large oven-safe skillet over medium heat and stir in thinly sliced onions with a pinch of salt.
Cook onions, stirring frequently, until softened, about 10 to 15 minutes.
Reduce heat to low or medium-low and cook onions, stirring often, for 60 to 90 minutes until golden and caramelized, adding water if needed to prevent burning.
Preheat oven to 375°F (190°C) and boil pasta according to package instructions; drain and set aside.
Transfer caramelized onions to a plate to cool; optionally add sugar or syrup during caramelization to speed process if needed.
In the same skillet, melt butter and whisk in flour to form a roux; cook for 2 to 3 minutes until golden and nutty.
Gradually whisk in milk, stirring constantly until mixture thickens; add nutmeg.
Stir in most of the grated Gruyere and Parmesan cheese until melted.
Add three-quarters of the caramelized onions and cooked pasta to the cheese sauce; mix until well combined.
Top with remaining cheese and caramelized onions; sprinkle with seasoned bread crumbs.
Bake in preheated oven for 25 to 30 minutes until golden and bubbly.
Remove from oven, garnish with fresh thyme, and serve warm.