To make the mornay: In a small saucepan over medium heat, melt the butter. Add the flour and stir, cooking until the mixture is lightly golden, 4 to 5 minutes. Add the milk, whisking to combine. Bring the mixture to a boil and reduce to simmer. To make an oignon pique, use the cloves to pierce the onion and the bay leaf, tacking them together. Add the oignon pique to the sauce and simmer for 30 minutes, stirring occasionally (the onion pique will inevitably fall apart, but it will be strained out later). Remove the saucepan from the heat and whisk in the cheese. Strain through a fine mesh sieve and season with nutmeg, salt, and pepper to taste.
To make the ragout: Clean the chard, separating the leaves from the stems. Dice the stems into ¼-inch pieces. In a medium saute pan, melt the butter over medium-low heat. Sweat the chard stems and onion until wilted, 2 to 3 minutes. Add the stock, bring to a simmer, cover with a parchment paper lid, and sweat until tender, 4 to 5 minutes. Remove the parchment paper, add the chard leaves, and wilt over medium heat, stirring frequently. Add the ham, remove the pan from the heat, and season with nutmeg, salt, and pepper to taste.
To finish: Preheat the oven to 400°F. Pour 1 ½ cups of the mornay sauce into a shallow 1-quart gratin dish (I used a 9-inch pie dish). Spoon the Swiss chard ragout into the dish and drizzle the remaining mornay sauce over the top. Top the gratin with the cheese and place in the oven. Bake for 10 minutes, and then broil until lightly browned, 30 to 45 seconds (or more depending on your broiler).