Heat butter and olive oil in a large pot over medium heat.
Add sliced onions and a pinch of salt. Cook slowly for 25–30 minutes, stirring occasionally, until deeply caramelized and golden brown.
Add minced garlic and cook for 30 seconds until fragrant.
Add dry pasta and pour in broth. Stir to combine.
Bring to a gentle boil, then reduce heat to medium-low. Simmer for 10–12 minutes, stirring occasionally, until pasta is al dente and liquid has reduced.
Stir in heavy cream, Gruyère (or mozzarella), and parmesan cheese.
Mix until cheese melts and sauce becomes creamy.
Season with black pepper and additional salt if needed.
Garnish with fresh thyme if desired and serve hot.