Preheat the oven to 375°F (190°C).
Steam or boil the green beans for 3-4 minutes, until just barely tender with still a little life left in them.
Drain and place the green beans in a bowl of ice water to shock them. Set aside.
In a large skillet, melt the vegan butter over medium heat. After 2 minutes, when the butter is fully melted and hot, add the mushrooms and onions, and sauté, stirring occasionally, for 5-6 minutes until they begin to brown.
Add the minced garlic, parsley and flour, and whisk rapidly for 60 seconds until the flour is fully absorbed.
Gradually whisk in the plant-based milk, vegetable bouillon paste, thyme, black pepper, and salt, stirring well to combine. Allow the mixture to simmer over low heat for 4-5 minutes until the sauce thickens slightly.
Drain the green beans in a colander and let the drip dry. Transfer them to a large baking dish and pour the mushroom sauce over them. Stir until the beans are evenly coated. Spread the fried onions or shallots evenly over the top.
Bake the casserole at 375°F (190°C) for 20 minutes, until the top is golden and crispy.
Before serving, garnish with fresh parsley leaves and finely minced red onion.