Melt butter in a large pot or Dutch oven over medium heat. Add the thinly sliced onions with a pinch of salt and cook, stirring occasionally, for about 15 minutes. The key is patience—as the onions turn golden brown, their natural sweetness deepens, creating the foundation of this dish.
Once the onions are beautifully caramelized, stir in the minced garlic, thyme, and flour. Cook for a minute or two to form a roux. You’ll notice the mixture thickening slightly, which ensures your sauce will have a luscious consistency.
Deglaze the pot by pouring in the white wine (optional but recommended). Scrape any browned bits stuck at the bottom—it’s all flavor! Then, add the broth and bring it to a light simmer. Stir in the uncooked pasta, ensuring it’s submerged in the liquid, then cover the pot. Cook according to the pasta package instructions, stirring occasionally to keep everything from sticking.
Once the pasta is tender and the liquid is mostly absorbed, remove the pot from the heat. Toss in the shredded Gruyère and Parmesan. Stir until the cheeses melt and coat the pasta in a glossy, irresistible sauce.
Dish up the pasta while it’s warm, garnishing with freshly cracked black pepper and perhaps a few extra thyme leaves. Serve immediately, and watch everyone swoon over the flavors!