Heat the oven to 350°. In a 9-inch nonstick skillet over medium heat, melt the butter. Fry the bread in the melted butter, making sure the butter does not brown, until light golden brown on the bottom, 1 to 2 minutes.
Arrange all the cheese on and around the bread evenly so that it covers the surface of the pan. Cook on medium-low heat until the cheese around the bread begins to melt, 2 to 3 minutes.
Place the skillet in the oven until the cheese on top of the bread is fully melted and the cheese around the bread is golden, 4 to 6 minutes. Remove from the oven, pour out the rendered fat and let the bread cool in the pan for a minute.
Using a rubber spatula, gently loosen the edges and carefully lift the sandwich and transfer it to a cutting board.
Place the skillet back onto the stovetop over medium heat, add the shallots and cook until the shallots begin to soften, 40 seconds to 1 minute. Add the apples and ham, and lightly toss until the ham is heated through, 1 to 2 minutes.
Place the shallot-ham mixture on top of the sandwich. Cut the bread in half diagonally and fold over to form a half sandwich. Cut once more to make two triangles. Transfer the sandwich to a plate. Top it with the egg and serve with grain mustard.