Preheat the oven to 375 degrees. Spray a 2 ½ - 3 quart baking dish with cooking spray.
Bring a large pot of salted water to a boil. Have a large bowl of water and ice ready. Add the green beans to the boiling water and cook for 3 minutes or until bright green and still crisp. Drain and pour the beans immediately into the ice water. Let sit for a minute or two, then drain well.
Heat the olive oil and 2 tablespoons butter in a large, deep skillet over medium-high heat until the butter melts. Add the mushrooms and cook, stirring occasionally, until browned, about 5 minutes. Remove the mushrooms from the skillet and add the remaining 4 tablespoons butter. Once the butter melts, add the diced onion and cook, stirring occasionally, until they are soft and translucent, about 5 minutes. Add the garlic and cook for another 30 seconds. Sift in the flour and cook for another minute. Add the stock, half-and-half, and tamari and cook, stirring, until the sauce thickens. Stir in the nutmeg, water chestnuts, reserved mushrooms, and beans. Taste and season with salt and pepper, if desired. Pour the mixture into the prepared baking dish and bake for 30 minutes.
While the casserole bakes, fry the shallots. Place the cornstarch in a small mixing bowl. Separate the shallots into rings and toss with the cornstarch to coat.
Line a plate with 2 layers of paper towels and place by the stove. Heat about 1 inch of oil in a large skillet or Dutch oven over high heat until the oil starts to shimmer. Fry the shallots in batches, turning occasionally, until browned. Remove with a slotted spoon, place on the paper towel lined plate, and sprinkle with a little salt. Continue until all the shallots have been fried.
After the casserole has baked for 30 minutes, top with the fried shallots and cook for another 5 minutes.