FOR THE TOPPING: Pulse bread, butter, salt, and pepper in food processor until mixture resembles coarse crumbs, about ten 1-second pulses. Transfer to large bowl and toss with onions; set aside.
FOR THE BEANS AND SAUCE: Adjust oven rack to middle position and heat oven to 425 degrees. Fill large bowl with ice water. Bring 4 quarts water to boil in large Dutch oven. Add 2 tablespoons salt and beans. Cook beans until bright green and crisp-tender, about 6 minutes. Drain beans in colander and plunge immediately into ice water to stop cooking. Spread beans on paper-towel-lined baking sheet to drain.
Add butter to now-empty Dutch oven and melt over medium-high heat until foaming subsides. Add mushrooms, garlic, 3/4 teaspoon salt, and 1/8 teaspoon pepper; cook until mushrooms release moisture and liquid evaporates, about 6 minutes. Add flour and cook for 1 minute, stirring constantly. Stir in broth and bring to simmer, stirring constantly. Add cream, reduce heat to medium, and simmer until sauce is thickened and reduced to 3 1/2 cups, about 12 minutes. Season with salt and pepper to taste.
Add green beans to sauce and stir until evenly coated. Arrange in even layer in 3-quart (or 13 by 9-inch) baking dish. Sprinkle with topping and bake until top is golden brown and sauce is bubbling around edges, about 15 minutes. Serve immediately.
The components of the casserole can be prepared ahead of time. Store the bread-crumb topping in an airtight container in the refrigerator and combine with the onions just before cooking. Combine the beans and cooled sauce in a baking dish, cover with plastic wrap, and refrigerate for up to 24 hours. To serve, remove the plastic wrap and heat the casserole in a 425-degree oven for 10 minutes, then add the topping and bake as directed. This recipe can be halved and baked in a 2-quart (or 8-inch-square) baking dish. If making a half batch, reduce the cooking time of the sauce in step 3 to about 6 minutes (1 3/4 cups) and the baking time in step 4 to 10 minutes.