Preheat the oven to 190°C and lightly grease a 2-liter baking dish.
Bring a large pot of salted water to a boil. Add the green beans and blanch for 4 minutes until bright green and just tender. Drain immediately and rinse under cold water, then drain well and set aside.
Heat the olive oil in a large skillet over medium-low heat. Add the sliced shallots and cook for 12 to 15 minutes, stirring often, until soft, deeply golden, and caramelized. Transfer half of the shallots to a small bowl for the topping and leave the remaining half in the skillet.
Add the chopped mushrooms to the skillet with the remaining shallots. Cook over medium heat for 6 to 8 minutes until the mushrooms release their moisture and begin to brown.
Add the butter to the skillet and let it melt. Sprinkle in the flour and stir constantly for 1 minute to form a smooth paste around the mushrooms.
Gradually pour in the milk and vegetable broth while whisking to prevent lumps. Add the salt, black pepper, garlic powder, and dried thyme. Simmer for 3 to 5 minutes, stirring often, until the sauce thickens enough to coat a spoon.
Add the blanched green beans to the skillet and fold gently until evenly coated in the mushroom sauce.
Transfer the mixture to the prepared baking dish and spread it into an even layer.
In a small bowl, combine the reserved caramelized shallots, chopped toasted hazelnuts, and panko breadcrumbs. Sprinkle the topping evenly over the casserole.
Bake for 20 minutes until hot and bubbling around the edges and the topping is lightly browned. Let the casserole rest for 5 minutes before serving.