Melt the butter in a 5-quart Dutch oven over medium heat. Add the onions and cook, stirring often, until soft and light golden, 13 to 15 minutes. Stir in the garlic for 30 seconds.
Sprinkle in the flour and stir for 1 minute. Gradually whisk in the stock, bring to a boil, then lower the heat and simmer 10 minutes.
Whisk in the cream cheese until smooth, then the half-and-half. Keep the soup just below a simmer and add the 2 cups of Gruyère a handful at a time, letting each melt before adding more.
Stir in the ham, 2 teaspoons mustard and the salt and heat through, 3 to 5 minutes.
Meanwhile, heat the broiler. Spread the bread with 1 teaspoon mustard, top with the remaining cheese and broil 5 inches from the heat until bubbling and browned, 1 to 2 minutes.
Ladle the soup into bowls, float a cheese toast on each and serve with cornichons.