Cook the pasta: Bring a large pot of salted water to a boil and cook the macaroni until just shy of al dente, about a minute less than the package suggests, since it will finish cooking in the oven. Drain and set aside.
Toss the shredded cheese with cornstarch this is the step that prevents a grainy sauce: In a bowl, toss the freshly shredded cheddar and gruyère with the cornstarch until evenly coated. This light cornstarch coating helps stabilize the cheese proteins as they melt into the hot milk, keeping the sauce smooth and emulsified instead of letting the fat and protein separate into a grainy, slightly oily mess this is genuinely the single biggest fix for anyone who’s had baked mac and cheese turn out gritty in the past.
Make the roux: In a medium saucepan, melt 3 tablespoons of the butter over medium heat, then whisk in the flour and cook for 1 minute, until lightly golden and no longer smelling raw.
Add the milk gradually: Slowly whisk in the milk, a splash at a time at first to avoid lumps, then continue cooking for 4–5 minutes, until the mixture thickens enough to coat the back of a spoon.
Melt in the cheese off direct heat: Remove the saucepan from heat, then add the cornstarch-coated cheese a handful at a time, stirring until each addition melts smoothly before adding more. Stir in the mustard powder, garlic powder, salt, and pepper.
Combine with the pasta: Preheat the oven to 375°F. Pour the cheese sauce over the drained macaroni and stir until every piece is evenly coated. Transfer to the baking dish.
Top and bake: Melt the remaining 1 tablespoon of butter and toss it with the panko and parmesan, then sprinkle evenly over the top. Pro tip: press the topping down gently so it makes good contact with the pasta underneath a loose, unpressed topping tends to slide off in clumps once baked.
Bake until golden: Bake for 20–25 minutes, until the top is golden brown and the sauce is bubbling at the edges. Let rest for 5 minutes before serving.