Preheat and prep: Heat the oven to 375°F (190°C).
Lightly grease a 9x13-inch baking dish.
Cook the pasta: Boil in well-salted water until very al dente (about 1–2 minutes shy of package time). Drain and set aside. Reserve 1/2 cup pasta water.
Sauté the spinach: Warm 1–2 tablespoons olive oil in a large skillet over medium heat.
Add garlic and cook 30 seconds until fragrant. Add spinach and a pinch of salt; cook until wilted. If using frozen spinach, add it squeezed-dry and warm through.
Mix the ricotta base: In a large bowl, stir together ricotta, cream, Parmesan, lemon zest, lemon juice, nutmeg, red pepper flakes, 1 teaspoon salt, and several grinds of black pepper.
If you like a firmer casserole, whisk in the egg. Adjust seasoning to taste.
Combine pasta and sauce: Add the drained pasta and sautéed spinach to the ricotta mixture. Stir until coated.
If the mixture seems thick, loosen with a splash of reserved pasta water until creamy but not soupy.
Add the cheese: Fold in 1 cup shredded mozzarella. Transfer the mixture to the baking dish, then sprinkle the remaining mozzarella and extra Parmesan over the top for a golden crust.
Bake: Cover loosely with foil and bake 15 minutes. Remove foil and bake another 10–15 minutes, until bubbling at the edges and lightly browned on top.
Rest and serve: Let it rest 5–10 minutes so the sauce sets slightly.
Garnish with chopped basil or parsley, if using. Serve warm.