Preheat oven to 200C.
For the white sauce, place the studded onion into a pan with milk. Bring to the boil and simmer for 5-10 minutes on low to flavour and infuse the milk. Set aside.
Heat the oil. Add onion, garlic, celery and carrots. Cook until tender.
Add lentils, tomatoes, tomato paste and herbs. Add stock and simmer for 30 minutes or until lentils are soft. Add more water if required (the mixture should be a little sloppy). Remove bay leaf and sprig of thyme. Season to taste.
In another pan, make the white sauce. Melt butter, add flour and cook for 1-2 minutes. Remove from heat and add the flavoured milk. Place back on the stove and stir until thickened and glossy. Season well and add cheese, stirring until melted.
Use a large (33cmx23cmx5cm) ovenproof shallow dish. Put into the bottom of dish some of the lentil mixture, then a layer of pasta sheets, half of the lentil mixture, half of the sauce, a layer of pasta sheets, remaining lentil mixture, a layer of pasta sheets and the remainder of the sauce.
Bake in the oven for 20 minutes or until bubbling and brown. Serve with a side salad.