Heat the oven to 350 °F, cover a baking sheet with parchment, and cook the onion, carrots, celery, diced pepper, and mushrooms in a large skillet over medium heat with a pinch of salt and pepper until tender. The vegetables should look softened, with their released moisture mostly evaporated.
Stir the garlic into the softened vegetables and continue cooking for 1 minute. Its aroma should become noticeable without the garlic darkening.
Use short food-processor pulses to combine the lentils and cooked vegetables with the tomato paste, bbq sauce, flax meal, parsley, salt, pepper, oats, and breadcrumbs, working in batches if necessary. Stop at a cohesive, coarse mixture with recognizable vegetable and lentil pieces rather than a smooth paste.
Gather the mixture into a ball on the prepared sheet and press it into a compact loaf, or pack it into the optional bell pepper halves arranged in a baking dish. The mixture should stay together, with no loose, crumbling edges.
Bake for 35 minutes, take the loaf out to coat the top with ketchup and a sprinkle of sugar, then return it to the oven for another 10 minutes. The surface should look set before glazing, and the finished topping should look glossy and caramelized around the edges.
Leave the baked loaf undisturbed for at least 10 minutes before cutting. As it cools, the interior firms up and offers more resistance to slicing.