To caramelize the onions, start by melting 2 tablespoons of the butter in a heavy skillet, over high heat. When butter foams, stir in the onions and add a sprinkle of salt. Allow onions to sit in pan for about a minute, without stirring. After a minute or so, stir over high heat for about five minutes until the onions become soft and translucent.
Lower the heat to medium, and continue to cook while stirring, for about 30 to 40 minutes until the onions take on a golden brown color and are fully melted. Then, remove onions from skillet and set them aside.
To cook the burgers, begin by adding the remaining butter to the skillet, over medium heat. Divide the beef into four equal portions and flatten slightly to form patties that approximately the same size as the bread. Generously with salt and pepper.
Increase skillet heat to high and place patties into the skillet. Be sure to leave plenty of space between them and allow to cook for 3 minutes without turning. Use a spatula to flip each patty and cook for an additional 5 minutes. Remove from skillet and allow to rest.
Lower heat to medium and place four slices of rye bread into the skillet, using the butter and fat to grill the bread. Place a slice of cheese on each piece of bread, add one of the cooked patties, top with caramelized onions, another slice of cheese, and then another slice of bread. Press down on the patties, using a spatula. After about 2 minutes, turn each patty over and grill the other side. (It might be necessary to and a couple more tablespoons of butter to the skillet at this point.) Cook another couple of minutes until the bread is brown and crispy and the cheese is fully melted. Cut each patty in half and then serve.
To save time, consider caramelizing the onions a day ahead of time. Refrigerate them and simply reheat them slowly when you are ready to make the patty melts.