Blanch the green beans: Bring a large pot of salted water to a boil, add the green beans, and cook them for 4–5 minutes until bright green and slightly tender. Drain them and immediately place them in an ice bath to stop the cooking. This keeps them crisp and prevents mushy casserole.
Cook the bacon: Heat a large skillet over medium heat and cook the diced bacon until crisp. Remove it with a slotted spoon and set it aside. Leave about 2 tablespoons of bacon fat in the pan for flavor.
Sauté the onions and mushrooms: Add the onion to the bacon fat and cook for 2–3 minutes until softened. Stir in the mushrooms and cook until they release their moisture and turn golden brown, about 5–7 minutes.
Add garlic and seasonings: Add the minced garlic and cook for 30 seconds until fragrant. Sprinkle in the onion powder, fresh thyme, salt, and pepper to deepen the flavor.
Build the roux: Add the 3 tablespoons of flour to the pan and stir for 1 minute to coat the veggies and cook out the raw flour taste.
Add broth and cream: Pour in the chicken broth slowly while stirring, then add the heavy cream. Mix well until the sauce becomes smooth and begins to thicken. Let it simmer for 4–5 minutes until thick and silky.
Melt in the cheese: Turn the heat to low and stir in 1½ cups cheddar until melted and creamy. Taste the sauce and adjust the seasoning as needed.
Combine everything: Add the blanched green beans and half of the cooked bacon to the sauce. Stir until everything is evenly coated.
Transfer to a baking dish: Pour the mixture into a greased 9×13 casserole dish and spread it out evenly.
Add topping: Sprinkle the remaining bacon, the 2 cups of shredded Gruyere, and the 6 oz crispy fried onions over the top.
Bake: Bake at 375°F for 25–30 minutes, or until the top is golden brown and the edges are bubbling.
Rest and serve: Let the casserole sit for 10 minutes before serving so it thickens and sets perfectly.