Use a large stockpot, (3 or 4 quarts), filled with water and 2 tablespoons of kosher salt, and bring to a boil. Add the fresh green beans and blanch for 5 minutes. Prepare a large bowl of ice water. Use a strainer to remove the beans from the water and place them into the ice water. Once the beans are cooled, remove them from the water, drain well, and reserve until the mushroom béchamel is finished.
Preheat the oven to 375° F, 190° C.
Use a dutch oven or large skillet with high sides and melt the butter on medium heat. Add the mushrooms and cook until their water is released and evaporated, 10 minutes.
Add the chopped onion along with the anchovy paste if you are using it. Stir to dissolve the paste and cook for 4 minutes until the onion become translucent.
Sprinkle in the flour and stir to coat the vegetables and cook for 1 to 2 minutes to get rid of the raw flour taste. Add the thyme sprigs at this time.
Pour in the chicken broth gradually while vigorously whisking to prevent lumps. Once fully blended, add the half and half and whisk. Bring to a slow boil and cook to thicken about 3 minutes. *Add Bacon. See the recipe notes. Taste the sauce and add salt and pepper as desired. I added about 1 teaspoon of salt and 1/2 teaspoon ground black pepper.
Remove from the heat and fish out the thyme sprigs. Add the green beans and fold together with the sauce.
Spray a 9 X 13 inch baking dish with cooking spray, then pour in the beans and sauce. Use a spatula or wooden spoon to even out the beans in a layer. Cover with aluminum foil, place in the oven for 30 minutes.
Take the casserole out of the oven and remove the aluminum. Sprinkle about half of the fried onions on top and use tongs to lift and combine the onions into the sauce and beans. Sprinkle the remainder of the fried onions in an even layer on the casserole. Place back in the oven uncovered for 5 minutes to allow the onions to brown and become fragrant and crunchy. Serve hot.