Preheat the oven to 400°F (200°C). Cut the spaghetti squash in half lengthwise and scoop out seeds.
Place squash cut side down on a baking sheet lined with parchment paper and roast for 40 minutes until tender.
Remove squash from oven and reduce oven temperature to 375°F (190°C).
While the squash roasts, melt 2 tablespoons butter in a large saucepan over medium heat.
Add chopped onion and sauté until translucent, about 5 minutes.
Add minced garlic and cook for another minute until fragrant.
Stir in flour and cook for 2 minutes to form a roux.
Gradually whisk in milk, ensuring no lumps form.
Add salt, pepper, and nutmeg then cook, whisking constantly, until sauce thickens, about 5-7 minutes.
Remove sauce from heat and stir in half of each cheese: Gruyere, cheddar, and Parmesan until smooth.
Use a fork to scrape the roasted spaghetti squash strands into the saucepan with cheese sauce and mix well.
Scoop the mixture back into the spaghetti squash shells.
In a small bowl, combine remaining butter and panko breadcrumbs.
Sprinkle the remaining cheeses over the squash and top with the buttered breadcrumbs.
Bake in the oven at 375°F for 25-30 minutes until the topping is golden and bubbly.
Garnish with fresh chopped parsley if desired and serve warm.