Preheat the oven to 180ºC.
Cook the macaroni according to the packet instructions, then drain and set aside.
Meanwhile, cut the onion in half. Peel half of the onion and garlic cloves. Put these in a pan and pour over the milk. Add the thyme sprig and the bay leaf. Slowly bring to the boil, then turn off the heat.
Melt the margarine in another, small saucepan over medium heat, add the corn flour and stir until get a thick paste. Add a ladleful of the warm milk and whisk until you get a smooth, thick cream.
Pour this into the milk and bring to the boil again. Simmer for 10 minutes, then remove the onion, herbs and garlic pieces. Stir in the mustard and nutritional yeast flakes. Grate in half of the vegan cheese (if using), or add more yeast flakes. Simmer until you get a thick sauce.
Taste, and season with salt and pepper.
Add the drained macaroni to the sauce and toss gently. Transfer the mixture to a baking dish, then grate the remaining cheese on top or scatter some breadcrumbs over it, if preferred.
Bake in the oven for about 20 minutes, or until golden and bubbling.
Let it rest for 5 minutes, then serve with freshly ground pepper.