Prepare the pasta: Preheat the oven to 375 degrees F.
Heat the oil in a medium saucepan over medium heat. Add the garlic and onions and cook, stirring occasionally, until the onions are softened, 3 to 5 minutes. Add the lentils and pasta sauce and cook, stirring occasionally, 5 minutes.
Meanwhile, make the vegan cheese sauce: Combine all of the ingredients in a high-powered blender and puree until smooth.
Make the vegan Parmesan cheese: Combine all of the ingredients in a blender or food processor; pulse until flaky. (See Cook's Note)
Combine the cooked pasta with the pasta sauce and toss to coat.
Spread half of the pasta in a 9-by-13-inch baking dish, then top with half of the cheese sauce. Repeat with the remaining pasta and cheese sauce. Sprinkle the vegan Parmesan over the top.
Bake until the top is slightly golden, about 25 minutes. Sprinkle with chopped basil and serve.
You can make the vegan Parmesan ahead and refrigerate in an airtight container for up to 6 months.