Peel and finely dice the onions. Wash and halve the tomatoes. Heat the oil in a pan, fry the tomatoes and onions for 2-3 minutes, turning over medium heat, season with salt and pepper and remove.
Crumble cheese.
Take the yeast dough out of the package, unroll. Halve lengthwise and divide by three to make 6 equally sized dough sheets. Fold the corners of the pastry sheets towards the middle and press them down slightly.
Place prepared dough plates next to each other on a baking tray lined with baking paper. Spread the tomato and onion mixture in the middle of each pastry sheet. Sprinkle cheese evenly on top. Whisk the egg yolks and 2 tbsp. water.
Spread the edges of the dough with it.
Bake in a preheated oven (electric cooker: 175 °C/ convection oven: 150 °C/ gas: see manufacturer) for 20-25 minutes. Wash the basil, shake dry and pluck the leaves from the stalks. Remove Copenhagen from the oven and place on a cake rack.
Sprinkle Copenhageners with basil and serve with some pesto.