Bring a large pot of water to a boil. Add the trimmed green beans and blanch for 2 minutes for crisp-tender beans or 6–8 minutes for softer beans. Drain and rinse under cold water or transfer to an ice bath to stop the cooking process.
Heat 1 tablespoon of olive oil in a medium skillet over medium heat. Add the diced shallots and sauté for 3–5 minutes, stirring occasionally, until softened and golden.
Reduce the heat to medium-low. Add the breadcrumbs, grated Romano or Parmesan cheese, and thyme to the skillet. Stir frequently and cook for 5–6 minutes until the breadcrumbs are golden brown. Remove from the heat and set aside.
Preheat the oven to 375°F and lightly grease a 13 × 9-inch baking dish. Heat the remaining tablespoon of olive oil in a large skillet over medium-high heat. Add the minced shallots and sauté for 1–2 minutes. Add the sliced mushrooms, season with salt and pepper, and cook for 6–8 minutes until softened and lightly browned.
Sprinkle the flour over the mushrooms and stir continuously for about 1 minute. Slowly pour in the chicken or vegetable broth, followed by the milk. Bring the mixture to a gentle boil, stirring occasionally, and cook for approximately 3 minutes until thickened. Stir in the grated Pecorino Romano cheese.
Add the blanched green beans to the mushroom sauce and stir until evenly coated. Taste and adjust the seasoning with salt and black pepper. Transfer the mixture to the prepared baking dish and spread it evenly.
Sprinkle the toasted breadcrumb mixture evenly over the green beans. Bake uncovered for approximately 30 minutes, until the casserole is hot and bubbling around the edges. Let it rest briefly before serving.