Preheat your oven to 350°F and lightly coat a 9x13-inch baking dish with non-stick cooking spray.
In a large skillet, heat the olive oil over medium-high heat. Sauté the onion, poblanos, and garlic until fragrant and tender, about 4–5 minutes.
Add the zucchini, yellow squash, corn, pico de gallo, and salt. Cook until the vegetables release their moisture and the mixture comes to a simmer, around 5–6 minutes. Simmer for 2 more minutes to reduce the liquid by half.
Remove the skillet from the heat and stir in the black beans and pinto beans until evenly combined.
Layer one-third of the vegetable mixture into the prepared baking dish and evenly top with 4 corn tortillas. Add half the remaining vegetable mixture, followed by the final 4 tortillas, and finish with the remaining vegetable mixture.
Sprinkle the top evenly with shredded cheese and bake for 25–30 minutes, or until the cheese is melted and bubbly.
Remove the casserole from the oven and let cool for 5 minutes. Top with diced avocado, scallions, and dollops of sour cream just before serving.