Preheat oven to 435˚F (225˚C).
Bring a large pot of salted water to a boil and add the dried macaroni. Cook, stirring occasionally, until the noodles are nearly al dente. They shouldn't be completely tender since they will cook further while in the oven. Drain and set aside.
While the noodles are cooking, melt the butter in a large pan over medium heat. Add the onion and cook, stirring occasionally, until softened. Stir in the ground beef, breaking up the pieces as they brown. Season with salt, pepper, and nutmeg.
Remove from heat once cooked through. Toss the ground beef mixture with the cooked macaroni and transfer to a large, ovensafe dish.
In a large bowl, whisk together the eggs and milk. Pour over the ground beef and macaroni in the large dish. Evenly top with the shredded cheese.
Bake in the preheated oven until golden and bubbly, about 30 minutes. If desired, serve with ketchup.