Place the milk and lemon zest over medium heat. Cook until hot (do not allow to boil). Remove saucepan from heat. Whisk egg yolks, sugar and flour in a bowl until well combined. Pour hot milk mixture over egg yolk mixture, whisking constantly.
Return mixture to saucepan over low heat. Cook, while stirring steadily in the same direction until the custard thickens and coats the back of a metal spoon (do not allow custard to boil, as it might curdle). Pour the custard into a bowl, cover the surface with cling film and leave to cool.
In a bowl (or on a wooden working surface) whisk together the flour, sugar, salt and lemon zest or vanilla (optional). Then add the egg until well incorporated into the mixture. Add the butter, cut into little pieces, and lightly knead to form a ball. Chill the dough, wrapped in plastic for at least 20 minutes.
Pre-heat the oven to 180 º C. Grease a baking tin of removable bottom with butter and flour.
On a lightly floured work surface, roll out 2/3 of the dough. Ease the pastry into the baking tin, pressing the dough into the corners. Don’t trim the overhang.
Spread the filling over the dough. Scatter the pine nuts over the mixture and gently press them in.
Roll out the remaining dough and cut a circle with 20 cm in diameter. Place the circle over the filling. Fold excess dough over the top of the pie in order to seal the filling. Bake the cake until golden brown (about 35 minutes). After 20 minutes, scatter pine nuts on top of the cake and keep baking.
Let it cool and dust with powdered sugar, before servings.