Preheat the oven to 350°F. Clean the veggies. Trim the green beans and slice the onions and mushrooms, keeping them separate. Mince garlic.
Boil a large pot of water, then add green beans and cook for about 6 minutes. While they cook, lay a platter with a towel. When they're crisp-tender, use tongs to take the green beans out onto the towel.
In a large pot, melt 2 Tbsp butter. Cook the onion on medium-low for 7-10 minutes, until very soft. Add mushrooms and cook 5 minutes more, stirring often. Add garlic and cook another minute. Transfer the veggies on top of the green beans.
In the hot pan, make a bechamel. Melt the rest of the butter over medium heat. Add the flour and whisk continuously until slightly golden, about 3 minutes. Slowly whisk in milk, salt, and pepper. Keep whisking until thickened, about 5 minutes.
Add the veggies back into the bechamel sauce and stir to coat. Transfer to a 9x9 inch baking dish and bake for 25-30 minutes, until bubbling.
When you're ready to serve, top with fried onions and bake 5 minutes more. Serve hot.