Prepare macaroni in boiling salted water according to the instructions on the packet. Peel onions and garlic. Dice both. Wash spinach and shake dry. Heat oil in a pot. Sauté onions and garlic in it. Add the spinach and let it collapse for about 5 minutes. Season with salt and pepper. Drain the pasta and let it drain.
Take the dough out of the refrigerator about 10 minutes before processing. Mix eggs and cream. Season with salt, pepper and nutmeg. Cut 3 strips (approx. 5 cm wide) from the baking paper. Grease a pie form (approx. 24 cm Ø, approx. 5 cm high) and lay it out in a star shape with the baking paper strips. Unroll the dough, remove it from the baking parchment and lay it on the baking parchment strips. Pull the dough up by the edge.
Spread 1/3 of the noodles in a circle on the dough base. Pour 1/3 egg cream over it. Spread half of the spinach on top and cover with 3 slices of ham. Alternately spread 1/3 noodles in a circle. Pour 1/3 egg cream over the pastry. Spread the rest of the spinach on top and cover with 3 slices of ham. Spread the rest of the noodles in a circle and pour the rest of the egg cream on top.
Grate the Parmesan finely and sprinkle over the macaroni. Spread butter in flakes on top. Bake in the preheated oven (electric cooker: 200 °C/ convection oven: 175 °C/ gas: see manufacturer) for about 1 hour. Take the macaroni cake out of the oven and arrange it.