Make the enchilada sauce: Heat olive oil in a small saucepan over medium-high heat. Add the tomato sauce, chili powder, garlic powder, onion powder, cumin, and 1/2 teaspoon salt and whisk to combine.
Whisk in the chicken broth. In a small bowl, mix the 2 teaspoons flour with 2 teaspoons water to form a slurry, then whisk the slurry into the sauce.
Reduce heat to low and simmer the sauce about 10 minutes, until slightly reduced and it coats the back of a spoon. Remove from heat and let cool to room temperature.
Prepare the filling: In a large skillet over medium heat, melt the butter. Add the diced onion and minced garlic and sauté about 2 minutes until fragrant and softened.
Add the cubed chicken, diced green chilies, paprika, 1/2 teaspoon onion powder, 1/2 teaspoon cumin, 1/2 teaspoon salt, and 1/4 teaspoon black pepper. Cook 5–7 minutes, stirring, until the chicken is cooked through and no pink remains.
Add the spinach and sauté about 1 minute until wilted. Remove the skillet from the heat and set the filling aside.
Preheat the oven to 375°F (190°C). Spoon a little enchilada sauce into the bottom of a 9x13-inch baking dish to prevent sticking.
Assemble enchiladas: Spread about 1 tablespoon sauce on a tortilla. Place a spoonful or two of the chicken filling in the center, drizzle a teaspoon or two of sauce over the filling, and add about 1 tablespoon shredded cheese if using. Roll the tortilla and place seam-side down in the baking dish. Repeat with remaining tortillas, filling, sauce, and cheese.
Bake uncovered for about 15 minutes, until tortilla edges are lightly crisp and cheese is melted.
Garnish with chopped cilantro and diced avocado if desired and serve immediately.