In a small bowl, combine 4 cloves garlic, rosemary, 1 tbsp thyme and 3⁄4 tsp pepper. Place tenderloins on a work surface. Make six 1/8 -inch-deep slits along length of pork. Spread garlic rub onto pork, pressing it into slits. Transfer tenderloins to a large roasting pan with rack and roast for 30 to 35 minutes, or until pork registers 145°F when tested with a thermometer in thickest part. Remove pork and set aside, covering loosely with foil for 10 to 15 minutes.
Meanwhile, fill a large pot with water and bring to a boil. Add green beans and cook for 2 minutes, until bright green. Drain and plunge into a large bowl filled with ice water; set aside for 5 to 8 minutes, then drain. Cut beans into 2-inch pieces.
Meanwhile, in a large skillet on medium-high, heat oil. Add mushrooms and sauté for 3 to 5 minutes until mushrooms release their juices. Reduce heat to medium and add shallots, remaining 1 clove garlic, remaining 1 tsp thyme, remaining 1/2 tsp pepper and salt. Cook, stirring constantly, until shallots become translucent, about 2 to 3 minutes. Sprinkle in oat flour; stir to coat. Slowly add buttermilk and continue to cook, stirring until buttermilk starts to thicken and mixture is creamy, 1 to 2 minutes. Stir in broth and green beans. When broth is absorbed, after 1 to 2 minutes, stir in 1/2 cup cheese.
Transfer mixture to an 8-inch square baking dish. Sprinkle bread crumbs and remaining cheese over top. Cover with foil and bake for 15 to 20 minutes, until bubbling. Remove and let cool for 5 minutes. Slice pork and serve with casserole on the side.