Melt 1 tablespoon butter in a skillet over medium; cook onions with a pinch of salt about 15 minutes until caramelized. Set aside.
Mix chilled macaroni with egg and panko; form 4 patties about 1/2-inch thick.
Heat oil in a large skillet over medium-high; cook patties 3-4 minutes per side until golden and crispy. Set aside.
Spread mayonnaise on one side of each bread slice.
Assemble mayo-side out: bread, Swiss, macaroni patty, onions, another Swiss slice, then top bread.
Melt remaining butter in skillet over medium; cook sandwiches 3-4 minutes per side until golden brown and cheese melts.
Halve; serve immediately, hot and crispy.