Preheat the oven to 375°F. Trim the green beans and cut them into 2-inch pieces.
Boil the beans in salted water for 4 to 5 minutes until bright green and just tender.
Transfer to ice water for 2 minutes, then drain and pat completely dry.
Melt the butter in a large skillet over medium-high heat. Add the mushrooms and cook 6 to 7 minutes until browned.
Add the shallot and garlic and cook 1 to 2 minutes until fragrant.
Stir in the flour and cook 1 minute. Slowly whisk in the broth, then the milk, soy sauce, nutmeg, salt, and pepper. Simmer 3 to 4 minutes until thickened.
Fold in the green beans and ½ cup of the fried onions. Spread into a 9x13-inch baking dish.
Bake 20 minutes. Top with the remaining 1 cup fried onions and bake 5 to 8 minutes more until golden and bubbling.