In a medium saucepan, combine the sugar, water, and lemon juice. Bring to a boil over medium heat, stirring occasionally.
Reduce the heat and let it simmer for about 10 minutes until slightly thickened.
Remove from heat and stir in the rose water or orange blossom water if using. Let the syrup cool to room temperature.
Preheat your oven to 350°F (175°C). Grease a 9-inch (23 cm) round baking dish or a similar-sized ovenproof dish.
Place the kataifi pastry in a large bowl and gently separate the strands. Pour the melted butter over the pastry and toss to coat evenly.
Spread half of the kataifi pastry evenly in the prepared baking dish, pressing it down gently.
In another bowl, combine the ricotta cheese, heavy cream, sugar, vanilla extract, and ground cinnamon (if using). Mix well.
Spread the ricotta mixture evenly over the layer of kataifi pastry in the dish.
Top with the remaining kataifi pastry, pressing down gently.
Bake in the preheated oven for 30-35 minutes, or until the top is golden brown and crisp.
Remove the knafeh from the oven and immediately pour the cooled syrup evenly over the hot knafeh.
Allow the knafeh to cool slightly before cutting into pieces.
Garnish with chopped pistachios if desired.
Enjoy your meal!