While the onions are baking, make the casserole. Bring a large pot of water to boil. Cook green beans for 7-9minutes, until tender. Immediately drain the beans into a colander and set aside.
In a skillet set over medium heat, melt the butter.
Add the mushrooms and cook for 6-8 minutes, stirring occasionally, until golden brown and reduced in size. Add the garlic and cook for another 2 minutes.
Sprinkle the flour over the mushrooms, stir, and cook for 2 minutes. Stir the heavy cream, Italian seasoning, salt, pepper, and nutmeg into the skillet and whisk well to combine. Continue cooking for about 5 minutes, until thickened. Remove from the heat, taste, and season with more salt and pepper, if desired.
Transfer the green beans to a large bowl and toss with the Parmesan. Pour the mushroom sauce over the beans and toss to coat.
Transfer the beans to the casserole dish and evenly distribute the onion topping over the top. Bake for 20-25 minutes, until the onions are golden and the sauce is bubbly.