Preheat oven to 425 degrees F (220 degrees C). Line a baking sheet with aluminum foil. Place squash, cut-sides down, on prepared baking sheet.
Bake squash in the preheated oven until soft, 45 minutes to 1 hour. Scoop out and mash squash flesh.
Stir 3 cups mashed squash, milk, white sugar, eggs, 1/4 cup melted margarine, flour, vanilla extract, cinnamon, nutmeg, ginger, and salt together in a 9x13-inch casserole dish. Spread mixture into an even layer.
Bake in the oven until casserole is set, about 45 minutes. Stir brown sugar, pecans, and 1/2 cup melted margarine together in a bowl. Sprinkle pecan mixture over the top of the casserole. Continue baking casserole until top is browned, 10 to 15 minutes more.