For the Topping: Pulse the bread, butter, salt, and pepper in a food processor until the mixture resembles coarse crumbs, about ten 1-second pulses. Transfer to a large bowl, toss with the onions, and set aside.
For the Beans and Sauce: Adjust the oven rack to the middle position and heat the oven to 425 degrees. Fill a large bowl with ice water. Bring 4 quarts of water to a boil in a large Dutch oven, then add 2 tablespoons of salt and the green beans. Cook until bright green and crisp-tender, about 6 minutes. Drain and immediately plunge the beans into the ice water to stop cooking. Spread them on a paper towel-lined baking sheet to drain.
In the now-empty Dutch oven, melt the butter over medium-high heat until foaming subsides. Add the mushrooms, garlic, 3/4 teaspoon salt, and 1/8 teaspoon pepper. Cook until the mushrooms release their moisture and the liquid evaporates, about 6 minutes. Stir in the flour and cook for 1 minute, stirring constantly. Gradually stir in the broth and bring to a simmer, continuing to stir. Add the cream, reduce the heat to medium, and let the sauce simmer until thickened and reduced to about 3 1/2 cups, about 12 minutes. Season with salt and pepper to taste.
Stir the green beans into the sauce until evenly coated. Transfer to a 3-quart (or 13-by-9-inch) baking dish and spread into an even layer. Sprinkle with the topping and bake until the top is golden brown and the sauce is bubbling around the edges, about 15 minutes. Serve immediately.