Preheat your oven to 180°C (350°F).
Cook the pasta in salted boiling water until just al dente, about 8 minutes. Drain and set aside.
In a large saucepan, melt the butter over medium heat, and add the diced onion. Cook until translucent and fragrant, about 5 minutes, until you notice a sweet aroma filling the kitchen.
Stir in the flour and cook for about 1 minute, whisking constantly to form a smooth roux.
Slowly pour in the milk while whisking, ensuring the mixture remains smooth and free of lumps. Continue to cook, stirring constantly, until the sauce begins to thicken and coats the back of a spoon.
Add the pumpkin puree and a pinch of freshly grated nutmeg, stirring until the sauce is velvety and well combined. Then, fold in the shredded cheddar cheese until melted and smooth.
Fold the cooked pasta into the cheese sauce, ensuring every piece is coated. Transfer the mixture to a buttered baking dish.
Sprinkle extra cheese on top, then bake uncovered until bubbling and golden, about 20 minutes.
Remove from the oven and let rest for 5 minutes. The top should be crispy and golden, and the sauce thick and velvety inside.
Serve warm and enjoy the comforting blend of sweet pumpkin, sharp cheese, and tender pasta.