Preheat the oven to 375. Toss the onions in the flour and half of the salt in a large mixing bowl until evenly coated. After tossing, reserve 2 tablespoons of the flour for the sauce. Rub the vegetable oil thinly on a baking sheet and toss the onions on top. Bake for about 25-35 minutes until the onions are toasty and crisp. Toss several times throughout baking to ensure even heating.
Meanwhile, in a saucepan over medium-high heat, melt the 2 tablespoons of butter and saute the mushrooms until they are softened slightly about 4-6 minutes. Add in the garlic, season with salt and pepper and then sprinkle in the flour. Cook for at least 1-2 minutes, stirring continuously to cook the flour and take away its grainy flavor.
Reduce the heat to medium and stir in the milk slowly until incorporated. Stir occasionally until it is thickened about 5-8 minutes.
Once thick, add in the green beans*, coat thoroughly. You can prepare the dish up to this point and finish cooking just before eating.
Transfer to a casserole dish and bake for 15 minutes until hot & slightly bubbling. Sprinkle the onions on top and bake
for 10-15 more minutes and serve.
*The green beans will be a bit firmer then the classic canned version. If you prefer softer green beans, blanch them for 2-3 minutes in boiling water until they are bright green before adding to the sauce in the casserole. Alternatively, use frozen green beans which are already blanched.