Soak onions in buttermilk or milk for 15 minutes. Meanwhile, combine the flour, salt, and pepper in a shallow dish, such as a pie pan.
2 cups buttermilk, 3 cups thinly sliced yellow or white onions, 2 cups all-purpose flour, 1 1/2 teaspoon fine sea salt, 1/2 teaspoon fresh ground pepper
In a large saucepan or dutch oven, heat the oil over medium heat to 375°F (use a digital thermometer).
4 cups avocado oil
Dredge the onions in flour until well coated and carefully add to the oil, frying in batches until golden brown, approximately 1 minute, then remove with a slotted spoon and drain on paper towel-lined plates. Allow the oil to come back to temperature in between batches.
Prepare the cream base:
Melt the butter in a saucepan set over medium-low heat, then whisk in the flour. Continue whisking until the roux has a nutty fragrance, 2-5 minutes.
4 tablespoons unsalted butter, 1/4 cup plus 1 tablespoon all-purpose flour
Slowly whisk in the vegetable stock, then whisk in the milk, garlic powder, onion powder, salt and pepper.
3/4 cup low-sodium vegetable stock, 1/4 cup plus 2 tablespoons whole milk, 1/4 teaspoon garlic powder, 1/4 teaspoon onion powder, 1/4 teaspoon fine sea salt, 1/8 teaspoon ground black pepper
Turn the heat up to medium-high and whisk constantly until the liquid is almost boiling, 5-6 minutes. Once thick, remove from the heat (it will continue to thicken slightly as it cools).
Prepare the casserole:
Preheat oven to 350°F. Grease a 9x13-inch casserole dish.
Add ice and cold water to a large bowl and place near the stovetop. In a large pot of salted boiling water, cook the green beans until bright green, 2 to 3 minutes. Using a slotted spoon or tongs, transfer the green beans to the ice bath to cool. Drain and transfer to a large bowl (you can use the same bowl).
2 pounds green beans
Melt the butter in a large pot or saucepan set over medium heat. Add the mushrooms and cook, stirring frequently, until browned, 6-7 minutes. Remove from the heat and add the garlic. Stir until fragrant, about 1 minute. Transfer mushrooms to the bowl with the green beans.