Cook the diced onions over medium heat until translucent and then add garlic and cook until fragrant.
Add the garlic powder, onion powder, paprika, chili powder, chili flakes, pepper, and salt. Stir until the spices are fragrant and then add flour to make a roux.
Add 2 1/2 cups broth and stir until the spices are incorporated into the liquid. Add the lentils and carrots and bring to a boil and then let simmer for about 20 minutes. The lentils will be tender but not mushy.
Meanwhile, melt the butter in a large pan. Cook the mushrooms until browned, then add the leeks. Cook the leeks are soft and have the same texture as translucent yellow onions would have.
Add the leek and mushroom mixture to the stew, and ladle stew into oven-safe bowls. Stir in some cheese and cover the bowls with a layer of the thawed puff pastry. Poke some holes for the steam to escape.
Using a pastry brush, wet the tops of the puff pastry with some whole milk. I didn't have egg yolks on hand otherwise I would have used those.
Bake in the oven at 350F for about 20 minutes, or until the pastry is golden and flaky-looking.