In a medium pot, add the lentils and 2 quarts water. Set the pot over high heat and bring the water to a boil. Reduce the heat to low and simmer the lentils until soft but not falling apart, about 25 minutes.
Pour the cooked lentils through a colander and let cool. In a large frying pan set over a medium-high heat, saute the carrots, onions, celery, garlic, thyme and salt with the 1/4 cup olive oil until the vegetables soften, about 10 minutes.
When the vegetables are tender and beginning to brown, stir in the tomato paste. Cook, stirring constantly, until the paste darkens, about 3 minutes. Stir in mushrooms and saute, stirring frequently, until completely cooked and browned on edges, about 15 minutes. Remove vegetables from frying pan and set aside to cool.
In a large mixing bowl, combine cooled vegetables with lentils and all remaining ingredients, save for the 2 tablespoons olive oil and the pesto. Mix until well combined. Place the mixture in the refrigerator to cool completely, about 25 minutes.
Drizzle the remaining 2 tablespoons olive oil into a large 9-by-12-inch baking dish, making sure to coat evenly. Roll the lentil mixture into round, golf-ball-size meatballs, making sure to pack the balls firmly. Place lentil balls into the oiled baking dish, making sure none of the meatballs touch one another.
Roast the lentil balls until firm and cooked through, about 30 minutes. Allow the meatballs to cool for five minutes before removing them from the tray. Serve with pesto.
Preheat the oven to 350 degrees F.
Spread the walnuts out on a 9-by-13-inch baking dish and roast until golden brown, about 12 minutes. Set the nuts aside to cool.
Fill a large stockpot three-quarters of the way full with water and bring to a rolling boil over high heat. Next, fill a large bowl with ice water.
Drop the spinach and basil into boiling water and give the leaves a stir. After 1 minute, remove the greens and plunge them into ice water. Discard the boiling water.
Once cool, remove the greens from the ice bath and squeeze them dry. Give them a rough chop and transfer to a food processor.
Add the salt, olive oil and Parmesan to the food processor and blend until a uniform, pesto-like consistency is reached.