How to Make It
Preheat oven to 350°F. Squeeze green beans lightly in hands to remove water.
Heat 2 tablespoons of the butter in a Dutch oven over medium-high. Add mushrooms and shallot, and cook, stirring often, until mixture is deeply browned and caramelized, 8 to 10 minutes. Transfer mixture to a plate, and without wiping out Dutch oven, add remaining 6 tablespoons butter to Dutch oven.
Melt butter over medium-high; whisk in flour, and cook, whisking constantly, 1 minute. Gradually add milk, whisking until smooth. Cook, whisking, until thickened and bubbly, about 4 minutes. Remove from heat, and whisk in Parmesan cheese, kosher salt, and black pepper until melted and smooth. Stir in green beans, mushroom mixture, and water chestnuts; spoon into a lightly greased 13- x 9-inch (3-quart) baking dish.
Bake in preheated oven until bubbly around edges, 15 minutes. Remove from oven; top with fried onions or shallots. Return to oven; bake until topping is golden brown, 15 minutes.
Make It Ahead
Prepare recipe through Step 2 up to 3 days in advance; cover and refrigerate. On the day of, add toppings and bake; add 10 minutes to the initial bake time if using a refrigerated casserole.