-
Bring a large pot of salted water to a boil. Cook the cavatappi until slightly under al dente, about two minutes less than the package directions. Drain well and set aside.
-
Melt 3 tablespoons of butter in a large Dutch oven or heavy saucepan over medium heat. Whisk in the flour and cook briefly until lightly golden. Slowly pour in the milk while whisking continuously to create a smooth sauce. Cook until the sauce thickens enough to coat the back of a spoon.
-
Remove from the heat and stir in the cheddar, most of the Gruyère, Dijon mustard, fresh thyme, and most of the salt. Mix until the cheese is completely melted and silky smooth.
-
Fold the cooked pasta into the cheese sauce along with most of the caramelized onions, saving a small portion for the topping. Transfer everything into a lightly greased baking dish.
-
Melt the remaining butter and toss it with the sourdough cubes and the remaining salt until evenly coated. Scatter the buttered bread cubes over the mac and cheese, then top with the reserved caramelized onions and the remaining Gruyère cheese.
-
Bake in a preheated 375°F (190°C) oven for about 25 minutes, or until the cheese is bubbling and the top is beautifully golden. Allow the dish to cool for about 5 minutes before serving. Finish with fresh thyme leaves and freshly cracked black pepper.