This recipe has great flavor, color and nutrition. We use the term "lasagna" loosely here: this delicious and unusual dish emulates the Italian classic, but without the pasta noodles. Mature leaf spinach can be substituted for the winter greens. The dish can be assembled a day in advance of baking and kept, covered, in the refrigerator. Reheat leftovers (if any!) in the microwave.
Position a rack in the lower third of the oven and preheat to 350 degrees F.
Cut the squash in half lengthwise and brush the flesh with the olive oil. Season with salt and pepper. Place the squash halves, skin-side up, in a shallow baking pan and add 1/2 inch of water to the pan. Bake until the flesh is pliable when the skin is poked with your finger, 30 to 45 minutes. Remove from the oven and set aside to cool. When cool enough to handle, remove and discard the seeds and strings. Scoop out the flesh and separate it into strands with your fingers.
Transfer the separated squash to a large bowl. Add half of the mozzarella, 1/2 cup of the parmesan, garlic, salt, and pepper to taste. Stir gently to combine. Set aside.
Raise the oven temperature to 500 degrees F.
Place the greens in a large bowl. Add the olive oil, shallots, a pinch of salt and pepper. Toss to coat the leaves. Transfer the greens to a rimmed baking sheet and roast until wilted and slightly crispy, 7 to 10 minutes. Remove from oven and let cool. Reduce oven temperature to 350 degrees F.
Combine the ricotta, pesto and remaining Parmesan in a small bowl.
Spread one-third of the spaghetti squash mixture in the bottom of a baking pan or flameproof casserole. Cover with half of the ricotta-pesto mixture, then top with half of the roasted greens. Repeat with remaining ingredients, ending with the spaghetti squash as the top layer. Sprinkle the remaining 2 cups of mozzarella and the parsley on top of the lasagna. Cover tightly with a piece of plastic food wrap, then cover that completely with a sheet of aluminum foil.
Bake until the sides of the lasagna begin to bubble, 30 to 40 minutes. Remove the foil and plastic wrap. Continue baking until the cheese browns, about 15 minutes. Remove from the oven and let rest at least 15 minutes before cutting to serve.
Note: If you don't want to use plastic because your casserole or baking pan isn't deep enough to keep the plastic from touching the food, the recipe will still work with just a sheet of aluminum foil. You may need to adjust cooking times based on your oven.