Preheat oven to 375 degrees.
Lightly grease a loaf pan and line with parchment paper, letting paper overhang sides of dish.
In a food processor, combine 1 cup of lentils, potatoes, garlic, tomato paste, tamari, onion flakes, flax meal, balsamic, tahini, oregano, thyme, celery seed, and black pepper. Pulse until well combined but not blended.
Add remaining 1 cup lentils, oats, and pumpkin seeds and pulse a couple of times, scraping down bowl as needed, until mixture is fairly well combined but still has texture—take care not to overprocess. Remove blade and use a silicone spatula to mix once more by hand.
Transfer mixture to prepared loaf pan. Smooth out with a spatula to evenly distribute in dish. Using the same spatula, spread ketchup or barbecue sauce on top.
Cover with aluminum foil. Bake for 30 minutes, then remove foil and bake for another 6 to 7 minutes, until topping is set.
Remove from oven and let cool in pan for 10 minutes. Lift loaf out of dish using parchment. Slice and serve.