Bake the bread. Bake gluten-free bread according to package directions from frozen.Let cool slightly, then slice into thick slices.
Caramelize the onions. Melt 2 tablespoons butter in a skillet over medium-low heat.Add sliced onion and salt.Cook for 12–15 minutes, stirring occasionally, until soft and caramelized.Remove from skillet and set aside.
Cook the patties. Form ground beef into 4 thin patties, slightly larger than the bread slices.Season both sides with salt and pepper.Cook in the same skillet over medium heat for 3–4 minutes per side, until cooked through.Remove patties and wipe skillet if needed.
Assemble the patty melts. Butter one side of each bread slice. On the unbuttered side, layer: Cheese (if using), beef patty, caramelized onions, another slice of cheese. Top with a second slice of bread, buttered side out.
Grill the sandwiches. Place sandwiches butter-side down in the skillet over medium-low heat.Cook 3–4 minutes per side, until golden, crisp, and cheese is melted.
Serve. Slice in half and serve hot.