Preheat a large, heavy-bottomed skillet over medium heat. Sauté onion in the olive oil with a pinch of salt until translucent, 7 to 10 minutes. Add the garlic and sauté a minute more. Add the rosemary, thyme, red pepper flakes, oregano, black pepper, and walnuts and toss to coat, toasting the walnuts for about 3 minutes. Add the mushrooms and salt. Sauté until lightly browned, about 5 minutes. Deglaze the pan with red wine and raise heat to reduce, about 3 minutes. Add the lentils and heat through. Press them with a spatula to mash them a bit. You're not making hummus; they should just be slightly mashed. Add breadcrumbs and marinara. Let cook for about 5 minutes, stirring often, then remove from heat and cool completely.