Preheat the oven to 400°F with a rack in the center position. Grease a 9×13 casserole dish with butter or cooking spray.
Slice the potatoes ⅛-inch thick using a mandolin and place them in cold water.
In a large skillet, melt the butter over medium heat. Add garlic and cook until fragrant. Stir in the flour and cook for 1-2 minutes.
Slowly add the chicken stock, thyme, salt, pepper, and nutmeg, stirring continuously. Cook until the mixture thickens, about 3 minutes.
Gradually add the milk while whisking until the sauce thickens, about 5 minutes.
Remove from heat and stir in 1 cup of cheddar cheese until smooth.
Layer ⅓ of the potatoes in the baking dish. Sprinkle with ½ teaspoon of salt, then pour ⅓ of the sauce over the top.
Repeat with remaining potatoes, sauce, and cheese. Top with the remaining cheese and cover the dish.
Bake for 35 minutes, then uncover and bake for another 40 minutes until bubbly and golden brown.
Let it rest for 15 minutes before serving. Garnish with thyme and cracked pepper.