Combine butternut squash, onion, cashews in a large baking dish or on a baking sheet. Add olive oil, salt, and pepper; toss to coat. Spread into a single layer.
Bake in the preheated oven until squash is browned and tender, about 30 minutes.
Melt butter in a skillet over medium heat; cook and stir sage and garlic until sage is wilted, about 2 minutes.
Bring a large pot of lightly salted water to a boil. Cook spaghetti in the boiling water, stirring occasionally, until tender yet firm to the bite, about 12 minutes. Drain and return spaghetti to the pot. Stir sage-butter mixture into spaghetti until coated; carefully fold in roasted squash mixture and Parmesan cheese.