Preheat the oven to 425˚F.
Spread the cubed squash out on a parchment-lined baking sheet, drizzle with oil and toss around with your hands to coat the cubes well. Season with salt and roast for 20-30 minutes, or until tender and turning golden. Reduce the oven temperature to 375˚F.
Set a large skillet over medium-high heat (it could be the skillet you plan to bake the pie in), add a drizzle of oil and cook the onion for a few minutes, until soft. Roughly chop the greens, discarding any tough stems, and add to the pan with the garlic and a sprinkle of salt. Cook for a few minutes, until wilted, then transfer to a bowl to cool slightly.
Unroll the thawed phyllo and remove a sheet, covering the rest as it waits. Lightly brush the sheet with melted butter or oil (you don’t need to coat it completely) and top with another sheet. Repeat, brushing with butter or oil between each sheet, then transfer the stack to a large (9-10-inch) oven proof skillet, pie plate or baking dish, letting the excess hang over the sides.
Spread the roasted squash into the bottom. Pour the beaten egg over the wilted greens and stir to combine them, then spread over the squash. Crumble the goat cheese (or drop it in pieces) over top. Pull the pastry up over the sides to partially enclose the filling, scrunching it up a bit if you like.
Bake for 20-25 minutes, until golden. Drizzle with chili oil, if you like, before serving, or at the table.