Trim and halve green beans, dice mushrooms and bacon, mince shallot and garlic, and shred cheeses.
Cook diced bacon in a large skillet over medium heat for 7–10 minutes until crispy. Remove and reserve approximately 2 tablespoons bacon fat.
Sauté mushrooms in the reserved bacon fat for 8–10 minutes until most of their moisture evaporates. Season gradually with salt and pepper.
Stir in butter, thyme, shallot, and garlic. Cook for 3–5 minutes until fragrant.
Stir in flour and cook for 2 minutes. Gradually add heavy cream and stir until thickened. Add half the Gruyère, half the Gouda, and half the bacon. Simmer gently.
Set oven to high broil. Toss green beans with olive oil and remaining seasoning. Broil on a baking sheet for 4–6 minutes until lightly charred. Watch closely.
Set oven to 350°F. Toss green beans with mushroom sauce and 1 cup crispy fried onions. Transfer to a baking dish.
Top with remaining bacon, cheeses, and crispy onions. Bake for approximately 15 minutes until hot, golden, and bubbly.