For topping:
Preheat oven to 450°F. Bake potatoes on a foil-lined baking sheet until tender, about 45 minutes. Let cool slightly, then peel. Press potatoes through a ricer, food mill, or colander into a large bowl. Add butter; stir until well blended. Stir in milk. Season to taste with salt. DO AHEAD: Potatoes can be made 1 day ahead. Let cool, press plastic wrap directly onto potatoes, and chill.
For filling:
Soak dried porcini in 3 cups hot water; set aside. Combine lentils, 1 garlic clove, 1 teaspoon salt, and 4 cups water in a medium saucepan. Bring to a boil; reduce heat and simmer, stirring occasionally, until lentils are tender but not mushy, 15ñ20 minutes. Drain lentils and discard garlic.
Heat 3 tablespoons oil in a large heavy pot over medium heat. Add onions and cook, stirring occasionally, until soft, about 12 minutes. Add chopped garlic and cook for 1 minute. Stir in tomato paste. Cook, stirring constantly, until tomato paste is caramelized, 2-3 minutes.
Add bay leaves and wine; stir, scraping up any browned bits. Stir in porcini, slowly pouring porcini soaking liquid into pan but leaving any sediment behind. Bring to a simmer and cook until liquid is reduced by half, about 10 minutes. Stir in broth and cook, stirring occasionally, until reduced by half, about 45 minutes.
Strain mixture into a large saucepan and bring to a boil; discard solids in strainer. Stir cornstarch and 2 tablespoons water in a small bowl to dissolve. Add cornstarch mixture; simmer until thickened, about 5 minutes. Whisk in miso. Season sauce with salt and pepper. Set aside.
Preheat oven to 450°F. Toss vegetables and pearl onions with remaining 2 tablespoons oil, 5 garlic cloves, and rosemary sprigs in a large bowl; season with salt and pepper. Divide between 2 rimmed baking sheets. Roast, stirring once, until tender, 20-25 minutes. Transfer garlic cloves to a small bowl; mash well with a fork and stir into sauce. Discard rosemary. DO AHEAD: Lentils, sauce, and vegetables can be made 1 day ahead. Cover separately; chill.
Arrange lentils in an even layer in a 3-quart baking dish; set dish on a foil-lined rimmed baking sheet. Toss roasted vegetables with fresh mushrooms and chopped herbs; layer on top of lentils. Pour sauce over vegetables. Spoon potato mixture evenly over.
Bake until browned and bubbly, about 30 minutes. Let stand for 15 minutes before serving.