Melt the butter over low heat in a small pot.
Remove the pot from the heat and add milk. Let the mixture cool to lukewarm (you should be able to dip your pinky finger in without burning) and dissolve the yeast in it.
Whisk sugar, salt, sour milk, and egg in the bowl.
Add the wheat flour and knead with a mixer or hand mixer with dough hooks.
Add the rye flour little by little until a suitable consistency is achieved. Finish kneading on a floured surface if necessary. The dough should be firm and soft but not too sticky.
Let the dough rise for 1 hour at room temperature.
Preheat the oven to 200 degrees Celsius (392 degrees Fahrenheit).
Divide the dough into two and roll each piece out into a rectangle (about 5 mm thick).
Spread the pesto on the two pieces of dough and sprinkle grated cheese over.
Fold each piece of dough in half and cut into strips about 2 cm thick. Twist each strip, roll it into a twist, and tuck the free end under the bottom.
Place the twists on a baking sheet, brush with egg, and bake for 18-20 minutes until they are nice and golden.