Put the butter and onions in a skillet over medium heat and brown the onions until dark, 40 to 45 minutes. Remove from the skillet and set aside. Add the sausage to the same skillet and crumble; cook until done, 5 to 8 minutes.
Roll the pastry out to 10 by 12 inches. Sprinkle the cheese over the pastry, then the sausage, then the onions. Roll both sides toward the center of the rectangle until they touch. Chill in the fridge for 20 minutes or place in the freezer for 10 minutes.
Preheat the oven to 400 degrees F. Line 2 baking sheets with parchment.
Slice the pastry into 1/3-inch slices and transfer them to the prepared baking sheets. Mix together the egg and 1 tablespoon water in a small bowl and brush the mixture over the top of the slices. Bake until golden brown, about 20 minutes.