Add the diced apples, butter, brown sugar, cinnamon, salt, cornstarch, and water to a saucepan. Cook over medium heat for 5 to 7 minutes, stirring often, until the apples are soft and the mixture is thick but still spoonable. Remove from heat and let cool slightly.
In a small bowl, combine the cream cheese, powdered sugar, vanilla extract, and milk. Mix just until smooth. Do not whip. Set aside.
Preheat the oven to 400°F.
Place a sheet of parchment paper on your work surface and lightly flour it. Roll the puff pastry into a large rectangle directly on the parchment. Carefully transfer the parchment paper with the pastry onto a baking sheet. Using a knife or pastry cutter, lightly mark the center third of the dough lengthwise without cutting all the way through. This helps guide where the filling will go.
Spread the cream cheese filling evenly down the center section, leaving about a 1-inch border on both sides.
Spoon the apple filling over the cream cheese in an even layer.
On both long sides of the pastry, cut strips from the edge of the dough toward the filling, about 1 inch wide, stopping at the edge of the center section.
Fold the top edge of the pastry down over the filling to seal the end. Then, working one strip at a time, bring a strip from the left side over the filling, followed by a strip from the right side.
Continue alternating left and right, crossing the strips over each other to create a braided pattern down the length of the pastry.
When you reach the bottom, stop braiding about three strips from the end. Cut off the final two side strips only, keeping the center section whole. Fold the bottom center section up over the filling to seal it cleanly. Discard the trimmed strips, or bake them separately as small pastry twists if desired.
To finish, cross the second-to-last strips over each other. Then overlap the final two end strips and gently tuck them underneath the loaf to seal.
Whisk together the egg and water to make an egg wash. Brush lightly over the pastry and sprinkle with coarse sugar if using. Bake for 22 to 25 minutes, until puffed and deep golden brown.
Let the pastry rest for about 10 minutes before slicing. Whisk powdered sugar with vanilla and a small amount of milk until smooth, then drizzle over the pastry. Slice thick and serve warm. Top with vanilla ice cream just before serving.