Heat the oven to 350 °F and coat a 9 by 13 inch baking dish with cooking spray. The dish should be fully greased so the saucy edges release easily after baking.
Warm the olive oil in a large skillet over medium heat, then cook the diced onion with the kosher salt for about 5 minutes. Stop when the onion looks soft and translucent, not browned.
Combine the shredded chicken, salt, black pepper, diced green chiles, and drained black beans in a bowl while the onion cooks. The filling should look evenly mixed and moist, but not loose or soupy.
Stir the chili powder and cumin into the skillet and cook for about 30 seconds, then mix in the flour. You should smell the spices bloom before you whisk in the liquid.
Slowly whisk in the chicken stock, then add the tomato sauce and minced garlic and bring the sauce to a simmer for 5 minutes, stirring now and then. The sauce should thicken slightly and smell savory with a clear garlic and chile aroma.
Blend the sauce until smooth if you want a silkier texture, then spread 1/2 cup in the bottom of the prepared dish and mix another 1/2 cup into the chicken filling. This gives you a saucy base without making the layers swim.
Coat 6 tortillas in the remaining sauce and arrange them across the bottom of the baking dish. It’s fine if they overlap a little, as long as the bottom is covered.
Spread half of the chicken mixture over the tortillas and top it with 1 cup of cheese. Try to distribute the filling edge to edge so every slice holds together.
Dip the remaining 6 tortillas in sauce and place them on top, then add the rest of the chicken mixture, pour over any remaining sauce, and finish with the last 2 cups of cheese. The top should be fully covered so it bakes into a bubbly, golden layer.
Bake uncovered for 25 minutes. The casserole is ready when the cheese is melted and bubbling across the surface.