Heat oven to 400°F. In a large skillet over medium heat, melt 2 tablespoons butter. When butter foams, add tomato paste and onion and cook, stirring, for 3 to 4 minutes, or until onion is soft. Stir in a pinch of salt, then add mushrooms. Increase heat to medium-high and cook, stirring, for 5 to 6 minutes, or until mushrooms are cooked and their juices have mostly evaporated. Add tomatoes, reduce heat to medium, and cook for another 2 to 3 minutes.
Add lentils and stir to combine. Add stock, bay leaf, and thyme, and bring to a simmer. Reduce heat to medium-low and simmer until slightly thickened, 15 to 20 minutes. Keep warm.
Meanwhile, add potatoes to a medium saucepan of salted water set over medium heat. Simmer potatoes until fork-tender, about 12 minutes. Drain potatoes. While they’re draining, melt 4 tablespoons butter in potato pan. Return potatoes to pan and toss to coat. Add milk and mash potatoes. Stir in ¾ cup of cheese. Taste and adjust seasoning as needed.
Add chard to the lentil mixture, increase heat to medium, and cook for 2 to 3 minutes, until greens wilt. Stir in corn and cook for 1 to 2 minutes. Add vinegar. Taste and adjust seasoning as needed. Discard bay leaf and thyme. Keep warm.
Melt remaining butter in a small skillet or saucepan. When it foams, add flour and whisk to form a paste (also known as a roux). Cook, whisking, until paste turns golden-brown. Ladle ¼ cup of lentil broth into the flour-butter mixture and whisk to combine. Pour the mixture back into the lentils and simmer for 5 more minutes—this will help thicken the filling.
Transfer lentil mixture to a 2-quart baking dish. Using a rubber spatula, drop big spoonfuls of mashed potatoes over the mixture, then carefully spread the potatoes to cover the entire surface. Place on a baking sheet and transfer to the oven for 10 minutes. Remove from oven, sprinkle remaining cheese on pie, and bake 10 more minutes, until bubbly and brown on top. Cool for 15 to 20 minutes before serving.