Prep the oven and pan: Heat the oven to 400°F (200°C).
Lightly grease a 9x13-inch baking dish or similar casserole dish.
Cook the squash: Place cubed squash on a baking sheet. Drizzle with 1 tablespoon olive oil, season with a pinch of salt and pepper, and toss. Roast for 25–30 minutes, stirring once, until very tender and lightly caramelized on the edges.
Sauté the aromatics: While the squash roasts, warm the remaining 1 tablespoon olive oil and 2 tablespoons butter in a skillet over medium heat.
Add chopped onion and a pinch of salt. Cook 6–8 minutes, stirring often, until soft and translucent. Stir in garlic and cook 30 seconds until fragrant.
Remove from heat.
Mash the squash: Transfer roasted squash to a large bowl. Mash with a potato masher or fork until mostly smooth, leaving a few small chunks for texture. You can also use a food processor for a silkier puree.
Build the filling: Stir in the sautéed onions and garlic, milk, sour cream, beaten egg, 1/2 cup Parmesan, cheddar or Gruyère, thyme, nutmeg, 1 teaspoon salt, and black pepper.
Taste and adjust seasoning. The mixture should be creamy but not soupy.
Make the topping: In a small bowl, toss panko with melted butter, remaining 1/4 cup Parmesan, parsley, and a pinch of salt until evenly coated.
Assemble: Spread the squash mixture into the prepared baking dish. Sprinkle the breadcrumb topping evenly over the surface.
Bake: Place the casserole in the oven and bake for 20–25 minutes, until the topping is golden and the edges bubble slightly.
Rest and serve: Let it rest for 10 minutes so it sets up.
Scoop and serve warm.