Preheat the oven to 200C (400F).
In a frying pan, add the apples, butter, cinnamon, salt, and vanilla extract. Cook over medium-low heat until the butter has melted. Add the sugar and cook for a couple of minutes until the apples soften slightly and release their juices.
In a small bowl, combine the cornstarch and water to make a slurry. Add it to the apples and cook for one more minute until the filling thickens.
Stir in the raisins and walnuts, then remove from the heat and let the mixture cool slightly.
Whisk the egg with one tablespoon of water to make an egg wash. Set aside.
Unroll the puff pastry onto a baking sheet. It usually comes with parchment paper, so place it directly on the sheet. Slightly roll it to make it flat if needed.
Spoon the apple filling lengthwise down the center of the puff pastry, leaving about a 1-inch border at the top and bottom.
Using a pizza cutter, cut the dough into 1-inch wide strips along both sides of the filling.
Starting at one end, fold the top edge over the filling, then alternately cross the strips from each side over the center, creating a braided pattern. Continue until all the strips are folded over. Fold the bottom edge over to seal the pie.
Brush the entire surface with the egg wash, then sprinkle lightly with sugar.
Bake in the preheated oven for 30–35 minutes, or until the pastry is golden brown and puffed.
Let the pie cool for at least 10 minutes before slicing. Serve warm, optionally with a scoop of vanilla ice cream or whipped cream.