Begin by heating your oven to 350°F. While the oven is heating, fill a large pot with water and set over high heat until you have a rolling boil. Then add the green beans and cook for about 6 minutes or until they are bright green and tender. When the green beans are done, remove them from the boiling water and set in an ice bath to stop the cooking process. Next, drain the water and set the beans aside.
Then in a large skillet, melt 2 tbsp. of butter over medium-high heat before adding the onion and allowing to cook until it's tender. This should take about five minutes or so. When the onions are done, add the mushrooms and cook until they are golden, making sure to stir often. When the mushrooms are golden brown, add the garlic and stir for a minute or so before transferring the mixture to the green beans.
Next, melt the remaining 4 tbsp. of butter in the skillet before whisking in the flour. Continue to whisk and cook until the flour is golden before gradually whisking in the milk and seasoning with salt and pepper. Allow the mixture to simmer until it starts to thicken, which should take 3-4 minutes. Then remove the skillet from the heat and fold in the green beans, mushrooms, and onions. To finish, bake the mixture in the oven for about 30 minutes before adding the fried onions and allowing to cook for five minutes more.