Prepare the Onions: Thinly slice onions and toss with olive oil, flour, panko, and a pinch of salt. Spread on a baking sheet and roast at 400°F, tossing every 10 minutes, until golden and crisp (about 20–25 minutes).
Blanch the Green Beans: Boil the water with salt in a big pot. Add green beans and cook for 4–5 minutes until crisp-tender and bright green. Drain and transfer to ice water to stop the cooking process, then dry thoroughly.
Make the Mushroom Sauce: Sauté mushrooms in olive oil until soft (8–10 minutes). Add garlic and thyme, then sprinkle flour over the mushrooms and stir. Gradually add milk, whisking to prevent lumps, and simmer until thickened (15–20 minutes). Add salt and pepper to taste and stir in Parmesan.
Assemble the Casserole: Spread a third of the sauce in a greased 9x13-inch baking dish. Add green beans, top with remaining sauce, and sprinkle with crispy onions.
Bake: Cover and bake at 400°F for 10 minutes, then uncover and bake another 10 minutes until bubbly and golden.