Preheat the oven to 375°F. Lightly grease a 9 x 13 inch baking dish.
Bring a large pot of water to a boil. Add the green beans and sea salt and cook for 4 to 5 minutes, until the beans are bright green and just beginning to become tender. Immediately transfer the green beans to a large bowl of ice water. Allow them to cool for 2 to 3 minutes, then drain thoroughly and set aside. To prepare the crispy onion topping, place the sliced onion in a medium bowl.
Beat the egg in a separate shallow bowl. In another bowl, combine the almond flour, gluten-free breadcrumbs, garlic powder, sea salt, and black pepper. Dip the onion slices into the beaten egg, allowing the excess to drip away. Toss them gently in the almond flour mixture until lightly coated.
Spread the coated onions in a single layer on a parchment-lined baking sheet. Lightly spray with avocado oil. Bake the onions for 12 to 15 minutes, tossing once halfway through cooking, until golden and crispy. Remove from the oven and set aside.
While the onions are baking, prepare the mushroom sauce. Melt the butter in a large skillet over medium heat.
Add the mushrooms and diced onion. Cook for 6 to 8 minutes, stirring occasionally, until the mushrooms have released their moisture and begun to brown. Add the garlic and cook for approximately 30 seconds, just until fragrant.
Sprinkle the gluten-free flour over the mushroom mixture and stir until everything is evenly coated. Cook for 1 minute.
Slowly pour in the broth while whisking or stirring continuously to prevent lumps. Add the milk, Worcestershire sauce, thyme, sea salt, and black pepper. Stir until combined.
Bring the mixture to a gentle simmer and cook for 4 to 6 minutes, stirring frequently, until the sauce has thickened enough to coat the back of a spoon.
Add the drained green beans to the skillet and gently toss until they are completely coated in the mushroom sauce. Transfer the green bean mixture to the prepared baking dish and spread it into an even layer.
Bake uncovered for 15 minutes.
Remove the casserole from the oven and arrange the crispy onions evenly over the top.
Return the casserole to the oven and bake for another 8 to 10 minutes, until the sauce is bubbling around the edges and the onion topping is crisp and golden.
Allow the casserole to rest for 5 minutes before serving.