Heat olive oil in a large skillet over medium heat, and sauté the diced onion and chopped carrots until they soften and release a sweet aroma, about 8-10 minutes.
Add minced garlic to the pan and cook for another minute until fragrant, stirring constantly to prevent burning.
Stir in the rinsed lentils and pour in the vegetable broth. Bring to a boil, then reduce heat to low, cover, and simmer for 25-30 minutes until the lentils are tender and most of the liquid has evaporated.
Meanwhile, place peeled and cubed potatoes into a large pot of salted water and bring to a boil. Cook for 15-20 minutes until very tender and easily pierced with a fork.
Drain the potatoes well, then mash them with butter, milk, salt, and pepper until smooth, fluffy, and creamy, adjusting seasoning as needed.
Stir in thyme and rosemary into the lentil mixture, tasting and adjusting the seasoning with salt and pepper for a savory, well-balanced filling.
Pour the lentil filling into a baking dish and spread the mashed potatoes evenly over the top, smoothing with a spatula and creating some ridges with a fork for crispiness.
Place the dish in a preheated oven at 200°C (392°F) and bake for 20-25 minutes until the top is golden and bubbling around the edges.
Remove from the oven and let rest for 5 minutes—this helps the filling set and makes slicing easier.
Slice into portions and serve warm, garnished with fresh herbs if desired, enjoying the hearty, earthy flavors and crispy topping.