Preheat oven to 350°F. Lightly grease a 9×13-inch baking dish.
Bring a large pot of lightly salted water to a boil. Cook spaghetti in boiling water, stirring occasionally until cooked through but firm to the bite, about 12 minutes. Drain.
Heat a large skillet over medium heat. Cook and stir the beef and onion until meat is browned and onions are soft and translucent, about 7 minutes. Drain. Mix in the spaghetti sauce and salt to the meat mixture.
In a large bowl, whisk together the eggs, Parmesan cheese, and butter. Add the spaghetti to the egg mixture and toss to coat. Place half the spaghetti mixture into the baking dish. Top with half of the cottage cheese, mozzarella, and meat sauce. Repeat layers. Cover with aluminum foil.
Bake in the preheated oven for 40 minutes. Remove foil and continue to bake until the cheese is melted and lightly browned, around 20 to 25 minutes longer.