Cut hot dogs lengthwise 3/4 of the way through. Insert a piece of cheese or 1/2 teaspoon caramelized onions into each hot dog, if using; set aside. If not using cheese or onions, poke hot dogs several times with the tip of a knife.
On a lightly floured work surface, working with one sheet of puff pastry at a time, roll into a 14-by-11-inch rectangle. Cut lengthwise into seven 1 1/2-inch wide strips. Cut each strip crosswise into 4 rectangles, each about 3 1/2 inches long.
In a small bowl, beat together egg and 1 tablespoon water; set aside. Line baking sheets with parchment paper or a nonstick baking mat; set aside. Place a hot dog on the narrow end of one piece of pastry. Roll to enclose, brushing with some of the beaten egg to adhere; transfer to prepared baking sheet. Repeat process with remaining hot dogs and pastry. Brush the tops of puff pastry with egg and sprinkle with seeds, if using. Transfer to refrigerator and let chill for 15 minutes.
Preheat oven to 450 degrees.
Transfer baking sheets to oven and bake until puffed and golden, about 20 minutes. Let cool briefly before serving with mustard and ketchup.