Put the flour in one small bowl and combine the chili powder, cumin, garlic powder, onion powder, and oregano (plus cayenne if using) in a second bowl. Open the tomato sauce and measure the broth, then set the salt and optional sugar next to the stove.
Place a medium saucepan over medium heat and add the avocado oil. Heat for 1 to 2 minutes until shimmery and thin; a pinch of flour should sizzle gently on contact. Keep the heat at medium.
Add the flour to the hot oil and whisk constantly for about 1 minute, until the mixture bubbles and smells slightly nutty. Stop when it is pale golden; lift the pan off the heat if it starts to darken quickly.
Add the bowl of spices (and cayenne if using) to the roux and whisk constantly for about 30 seconds, until it looks like a smooth, fragrant paste. Do not go past 45 seconds.
Pour in the full can of tomato sauce while whisking and stir until the thick paste loosens and turns a uniform deep red. Scrape the bottom and corners of the pan.
Pour in the broth in three additions, whisking until smooth after each one, until no lumps remain and the sauce looks glossy.
Bring to a gentle bubble, then reduce heat to medium-low and simmer for 10 to 12 minutes, whisking every minute or two. The sauce is ready when it coats the back of a spoon and a finger drawn through it leaves a clear line.
Remove from the heat and stir in 1/2 teaspoon of salt. Taste and add a pinch more salt if flat, or the optional 1/2 teaspoon of sugar if sharp or bitter. Add more cayenne only if you want more heat.
Pour the warm sauce over assembled enchiladas, or let it cool for about 10 minutes. Use an immersion blender for a few seconds for a perfectly smooth sauce, then transfer leftovers to a clean jar and refrigerate once at room temperature.