In a small saucepan, add sugar and water over high heat and bring to a boil, turn down the heat and let it simmer for 4-5 more minutes.
2 cups sugar, 1 cup water
Add in the vanilla extract and lemon juice, stir, and then turn off the heat. Allow it to cool completely.
1 teaspoon vanilla extract, ½ teaspoon lemon juice
Preparing the filling
In a small saucepan, add sugar, cornflour and milk over medium heat, whisk constantly for 2-3 minutes until the mixture thickens, and there are no lumps at all.
Add in vanilla extract, stir and turn off the heat and allow it to cool.
1 teaspoon vanilla extract
Prepare the Kunafa
Preheat the oven to 190C/370F and grease a 22 cm baking pan with ghee, and set aside.
Put the pastry in the food processor and blitz until you have fine strips of Kunafa.
400 g Kunafa dough
Pour the melted ghee over it and mix it thoroughly (rub the Kunafa with ghee using your hands).
240 g ghee
Add half of the pastry to the bottom of the prepared baking pan, press on it with the palm of your hand until you get a flat layer of Kunafa. Now add pastry around the edges of the tray and press on them as well.
Pour the cream filling into the centre of the pan and spread it out over the first layer of pastry.
Top the cream with the rest of the pastry and press it down gently using both hands.
Bake in the oven for 40-45 minutes or until the top becomes golden brown.
As soon as you remove it from the oven, pour the cooled syrup evenly over the top. Let it sit for 10 minutes, so all the syrup is absorbed.
Sprinkle some ground pistachio on top, then cut it and serve.
1 tablespoon pistachio
Notes
I get the Kunafa pastry from a Middle Eastern store. You may also find it under the name "kataifi dough".