Bring 2 ½ cups water or veggie broth to a boil in a medium saucepan over high heat. Add the lentils, partially cover the pan with a lid, and cook until tender, 30 to 40 minutes. Drain (if needed) and set aside.
Preheat the oven to 350F. Spread the walnuts on a small baking sheet and toast for 10 minutes in the oven until deepened in colour and they smell fragrant and toasty.
In a small bowl, stir the ground flax seeds and ½ cup water together, then set it aside to thicken while you prep your other ingredients (about 10 mins).
Heat the oil in a large skillet over medium-high heat. Add the onion, celery, and garlic, and sauté until the onion softens, about 3 minutes.
Add the shredded carrot, apple, sage and cumin seeds, salt and pepper, cooking until the apples begin to soften and release their liquid, about 5 to 7 minutes.
Line a loaf pan with parchment paper and set aside.
Once the apples are soft, remove the pan from the heat and transfer the contents to a large mixing bowl. Add the nutritional yeast, cooked lentils, flax mixture, minced walnuts, oats and oat flour, salt, pepper, and chili flakes. Stir well to combine all the ingredients, taste and adjust seasonings as needed.
The mixture should stick together, but you can also add an immersion blender to the mixture and blend for 5-10 seconds or until a small portion is blended, which can help the mixture stick together better. Transfer the mixture into the prepared loaf pan.
Mix the balsamic vinegar and ketchup in a bowl until combined. Spread it evenly over the top of the loaf. Bake uncovered for 30 minutes, or until the top feels firm to the touch and glaze has deepened in colour.
Cool the loaf for 10-20 minutes before slicing. Enjoy hot!