Bring a large pot of lightly salted water to a boil. Cook elbow macaroni in the boiling water, stirring occasionally, until cooked through but firm to the bite, 8 minutes; drain.
Preheat oven to 350 degrees F (175 degrees C). Lightly grease a casserole dish with cooking spray.
Melt margarine in a saucepan over medium heat. Cook and stir onion and garlic in hot margarine until softened, about 5 minutes.
Stir flour, mustard, and pepper into onions and cook for 30 seconds. Gradually pour in milk, stirring constantly until sauce thickens. Remove from heat and stir grated Cheddar cheese into the sauce until cheese is completely melted.
Mix macaroni, cottage cheese, and Cheddar cheese sauce together in a bowl; pour into prepared casserole dish and top with bread crumbs and Parmesan cheese.
Bake in the preheated oven until cheese is melted and sauce is bubbling, 20 minutes.