Preheat your oven to 375 degrees Fahrenheit. Lightly grease a 1.5-quart casserole dish.
Blanch the green beans: Bring a large pot of salted water to a boil. Add the green beans and cook for 3 to 4 minutes until bright green and tender-crisp. Immediately drain and plunge them into an ice bath to stop cooking. Drain well.
Heat the olive oil in a large saucepan over medium heat. Add the chopped onion and cook until soft, about 5 minutes.
Add the sliced mushrooms and cook until they release their liquid and brown slightly, about 8 minutes. If using, pour in the sherry or wine and cook until evaporated.
Sprinkle the flour over the mushroom mixture and stir constantly for 1 minute.
Gradually whisk in the milk until the sauce is smooth. Bring the mixture to a simmer, stirring until it thickens enough to coat the back of a spoon, about 5 minutes.
Remove the sauce from the heat. Stir in the salt, pepper, and nutmeg. Fold in the blanched green beans and the thawed peas.
Pour the mixture into the prepared casserole dish. Sprinkle 1 cup of the crispy fried onions evenly over the top.
Bake for 20 minutes. Remove from the oven and sprinkle the remaining 1/3 cup of crispy onions over the top. Bake for another 5 minutes until the topping is golden brown.
Let the casserole rest for 5 minutes before serving.
Notes
You can substitute canned green beans for fresh, but drain them very well before adding them to the sauce.
For a richer flavor, use heavy cream instead of milk in the sauce.
This casserole can be assembled up to 24 hours ahead of time; cover and refrigerate, then add 10-15 minutes to the initial baking time.