Bring a large pot of salted water to a rolling boil over medium-high heat and keep it boiling for the gnocchi.
Heat a large high-sided skillet over medium heat, then add the olive oil and diced onion. Season with a pinch of salt and cook until the onion is soft and beginning to brown, about 4–5 minutes.
Add the minced garlic and dried thyme and cook for 1 minute until fragrant.
Add the butter and stir until fully melted.
Sprinkle the flour over the butter-onion mixture and stir constantly until it thickens and bubbles, about 1 minute to cook the raw flour taste.
Slowly pour in the milk while whisking or stirring constantly to prevent lumps; whisk any remaining lumps smooth. Bring the sauce to a gentle simmer and cook until thick enough to coat the back of a spoon, about 5 minutes.
Remove the sauce from the heat and stir in the ground nutmeg. Season with salt and pepper to taste.
Add the gnocchi to the boiling water and cook according to the package instructions, usually about 3 minutes, until they float to the top.
While the gnocchi cook, stir the grated Parmesan, fresh spinach, and lemon juice into the cream sauce; the spinach will wilt from the sauce heat.
When the gnocchi rise, scoop them from the pot with a spider or slotted spoon and transfer directly to the skillet with the sauce. Toss gently to combine.
If the sauce is too thin, add 1/4–1/2 cup of the hot starchy gnocchi cooking water and toss until the sauce reaches the desired consistency.
Serve immediately, topping with extra grated Parmesan if desired.