Preheat the oven to 400°. Grease an 8-inch square baking dish.
Melt 6 tablespoons of butter in a large skillet over low heat until bubbling. Whisk in the flour and cook for 1 minute. Slowly whisk in the milk and cook until thick and bubbling, 3 to 5 minutes more. Whisk in the mustard, salt, pepper, and nutmeg.
Pour a thin layer of the sauce into the prepared baking dish and cover it with 5 or 6 slices of the bread, then slices of the ham and an even layer of the Gruyere. Repeat the layers once more, ending with a third layer of sauce to cover all. Bake the casserole for 30 minutes. Remove it from the oven and cut into 6 equal pieces.
Working in 2 batches, melt 1 tablespoon of butter in a large skillet over medium-high heat. Crack 3 eggs into the skillet and season with salt and pepper, to taste. Cook until the whites are nearly set, about 3 minutes. Carefully flip the eggs and continue cooking until the whites are completely set, about 1 minute more. You're going to top each portion of the casserole with a fried egg. Repeat with the remaining 3 eggs and 1 tablespoon butter. Top with Gruyere and place it in the oven for a few minutes until cheese melts.