Preheat oven to 350°F and spray a 9x13 inch baking dish with cooking spray.
For the enchilada sauce, heat 1 Tbsp oil in a large skillet over medium heat. Add diced onion and salt; cook until translucent (about 5 minutes).
In a separate skillet, cook ground beef with salt and pepper, breaking it up. Add the second diced onion and cook until beef is fully cooked (about 5 minutes).
To the onion in the sauce skillet, add chili powder and cumin; cook for 30 seconds. Stir in flour, then slowly whisk in chicken stock. Add tomato sauce and garlic, bringing to a simmer. Cook for 5 minutes, stirring occasionally.
Once beef is cooked, drain fat and add green chiles and black beans.
Optionally blend the sauce until smooth. Spread 1/2 cup sauce on the bottom of the baking dish. Add 1/2 cup of sauce to the beef mixture.
Dip 6 tortillas in remaining sauce, then line the bottom of the baking dish with them.
Layer half the beef mixture over the tortillas, then sprinkle 1 cup of cheese on top.
Dip the remaining tortillas in sauce, then layer with the remaining beef mixture and 2 cups cheese.
Bake uncovered for 20 minutes or until cheese is bubbly.