Preheat oven to 350°F.
Generously butter a 14-inch baking dish, season lightly with flaky sea salt, and arrange the leeks upright in a single layer. Sprinkle the tops with an extra pinch of salt.
In a saucepan over medium heat, melt the butter and add the anchovy fillets, stirring until they dissolve.
Add the shallots and sauté until softened, then stir in the grated garlic and thyme leaves.
Pour in the chicken broth, milk, and heavy cream, stirring until combined.
Reduce the heat and gradually stir in the Gruyère and Parmesan until fully melted.
Add the freshly cracked black pepper, rosemary leaves, and a small amount of crumbled bouillon. Taste before adding more, since the anchovies and cheese already contribute salt.
Allow the sauce to gently simmer for a few minutes, stirring frequently.
Pour the cream mixture evenly over the leeks, cover tightly with foil, and bake for 40 to 50 minutes, or until the centers are fork-tender. Add extra time if needed.
Remove the foil and bake for another 5 to 10 minutes, until golden and bubbling.
Let rest for 5 minutes, then serve with sliced, toasted baguette.