Preheat the oven. Set to 375°F (190°C). Lightly grease a 9x13-inch baking dish.
Cook the aromatics. Heat oil in a large skillet over medium heat. Add onion and cook 3–4 minutes until softened.
Stir in garlic and cook 30 seconds.
Brown the meat. Add ground beef and cook, breaking it up, until no longer pink. Drain excess fat if needed.
Season it right. Stir in taco seasoning with a splash of water (about 1/4 cup). Simmer 1–2 minutes to coat the meat evenly.
Add the mix-ins. Fold in black beans, corn, salsa, and diced tomatoes with green chiles (if using).
Taste and adjust salt and pepper.
Prep the tortillas. If using corn tortillas, lightly warm them so they don’t crack. Cut tortillas in halves or quarters to fit the dish in even layers.
Build the first layer. Place a single layer of tortillas on the bottom of the dish. Spread one-third of the meat mixture over them.
Sprinkle a generous handful of cheese.
Add a creamy touch (optional). Dot or spread a few spoonfuls of sour cream over the cheese for a richer bite.
Repeat the layers. Add another tortilla layer, another third of the meat, more cheese, and optional sour cream. Finish with a final layer of tortillas, the remaining meat, and a thick blanket of cheese.
Bake. Cover with foil and bake for 15 minutes. Remove foil and bake another 10–12 minutes, until the cheese is melted and bubbling with lightly golden spots.
Rest and garnish. Let it rest 5–10 minutes for cleaner slices.
Top with cilantro, green onions, or your favorite fresh toppings.
Serve. Spoon onto plates and add lettuce, tomatoes, avocado, sour cream, or a squeeze of lime for brightness.