Preheat an oven to 350°F. Lightly butter a deep 2 1/2-quart baking dish. Trim the green beans and halve crosswise. Bring a saucepan of salted water to a boil over high heat. Add the green beans and cook until tender-crisp, about 4 minutes.
Drain and rinse under cold running water. Pat dry with paper towels and set aside. In a saucepan, melt the butter over medium heat. Add the mushrooms and cook, stirring, until they give off their juices and are browned, 6 to 7 minutes. Stir in the 3 Tbs. minced shallots and cook until softened, 2 to 3 minutes. Sprinkle with the 3 Tbs. flour and stir well. Slowly stir in the half-and-half, stock and soy sauce and then bring to a boil, stirring often. Reduce the heat to low and simmer, stirring, until thickened, 4 to 5 minutes. Stir in the green beans, season with salt and pepper and transfer the mixture to the prepared baking dish. (The casserole can be prepared to this point up to 1 day ahead, covered and refrigerated.) Bake until the liquid is bubbling, about 20 minutes (30 minutes if it has been refrigerated).
While the casserole is baking, pour oil to a depth of 2 inches into a heavy saucepan and heat over high heat to 350°F on a deep-frying thermometer. Line a baking sheet with paper towels and place near the stove. Cut the remaining 3 shallots crosswise into slices 1/8 inch thick and separate into rings. Place the remaining 1/3 cup flour in a small bowl. Toss the shallot rings in the flour to coat evenly, shaking off the excess. In batches to avoid crowding, add the shallots to the hot oil and deep-fry until golden brown, about 30 seconds. Transfer to the paper towels to drain.
Remove the casserole from the oven, scatter the fried shallots on top and serve. Serves 6 to 8.
Adapted from Williams-Sonoma Comfort Food, by Rick Rodgers (Oxmoor House, 2009).