12 (3/4"-thick) slices day-old white bread, such as Pullman, pain de mie, or country bread (a square-shaped loaf works best)
6 tablespoons unsalted butter
3 tablespoons all-purpose flour
3 cups whole milk
1/4 teaspoon freshly grated or ground nutmeg
1 1/4 teaspoons kosher salt, divided
1/2 teaspoon freshly ground black pepper, divided
3 1/4 cups grated Gruyère (about 10 ounces), divided
1/4 cup Dijon mustard
12 thin slices Black Forest ham (about 10 ounces)
6 large eggs
Nonstick vegetable oil spray
Arrange racks in top and middle of oven; preheat to 375°F. If bread is not a day old or still feels moist, arrange slices in a single layer on a baking sheet and bake, flipping once, until dry to the touch but not toasted, 5–10 minutes. Using a 2" ring or cookie cutter or sharp paring knife, cut a hole in the center of 6 bread slices. Trim bread to fit in 2 even layers in a 13x9" baking dish, with the whole slices on the bottom and the slices with holes on the top, forming 6 sandwiches. Remove from dish.
Melt butter in a medium pot over medium heat. Add flour and cook, whisking constantly, until butter foams then subsides (make sure it doesn't brown), and mixture is light gold and thickened, about 3 minutes. Slowly add milk, whisking constantly to prevent lumps from forming. Increase heat to medium-high and cook, whisking, until mixture thickens and coats the back of a spoon, 4–6 minutes. Reduce heat to very low. Whisk in nutmeg, 3/4 tsp. salt, and 1/4 tsp. pepper into the Béchamel sauce. Whisk in 1 cup Gruyère a handful at a time, making sure cheese is melted before adding more. (Béchamel with cheese added is technically called a Mornay sauce.) You should have about 3 1/2 cups of sauce.
Spread one-third of the Béchamel in the dish. Arrange 6 whole slices of bread in a single layer in dish. Spread Dijon evenly on bread. Top each with 2 slices of ham, folding to fit on bread if necessary.
Spread another third of the Béchamel over ham. Sprinkle evenly with 1 cup Gruyère. Place 6 bread slices with holes on top to form 6 sandwiches. Spread remaining Béchamel over sandwiches; sprinkle with 1 cup Gruyère (avoid holes to save room for eggs).
Crack 1 egg into each hole. Sprinkle with remaining 1/4 cup Gruyère. Season with remaining 1/2 tsp. salt and 1/4 tsp. pepper.
Spray a large piece of foil with nonstick spray. Place foil, oiled side down, over baking dish, crimping to seal. Bake on middle rack for 20 minutes. Remove foil, increase oven temperature to 400°F, transfer dish to top rack, and bake until egg whites are just barely set and yolks are still runny (eggs will continue to cook slightly when removed from oven), 8–12 minutes. Let cool 10 minutes before serving.