Gradually pour in the milk to dilute and season to taste. Flavor with a generous grating of nutmeg and bring to boil.
Turn off the heat and stir in half the Parmesan. Mix well and leave the resulting béchamel to cool.
Sauté the onion and the peas in 2 tablespoons of oil for 10 minutes.
Season to taste, allow to cool and stir in 1/3 of the béchamel sauce.
Beat the eggs with a pinch of pepper and salt and stir in the remaining béchamel sauce and half the mozzarella.
Cook the spaghetti al dente in a generous amount of boiling salted water, about 4 minutes.
Drain, refresh in cold running water and stir in the egg mixture.
In a ring-shaped cake tin, transfer half pasta and cover with the ham, the remaining mozzarella, the peas and the Parmigiano set aside.
Finish off with the remaining spaghetti and press down well with the back of a spoon. Bake in a preheated oven at 200°C for 20 minutes, turning the tin round after 10.
Remove from the oven and leave to cool for 3 minutes.
Turn out the pasta ring cake onto a dish and serve.