01 - Preheat the oven to 400°F. Line a baking sheet with parchment paper and set aside.
02 - Melt the butter in a skillet over medium heat. Add the diced apples, brown sugar, cinnamon, nutmeg, and lemon juice. Cook for 6 to 8 minutes, stirring frequently, until the apples are tender and the juices have thickened into a syrup. Remove from heat and let cool completely.
03 - In a mixing bowl, beat the softened cream cheese, granulated sugar, and vanilla extract together until smooth and creamy. Set aside.
04 - Unfold the thawed puff pastry onto a lightly floured surface and roll gently to smooth out any creases. Cut the sheet into 8 equal squares.
05 - Transfer the pastry squares to the prepared baking sheet. Using a knife, lightly score a smaller square border inside each piece without cutting all the way through. Prick the inner square several times with a fork to prevent puffing. Spread a spoonful of cream cheese filling inside the scored border, then top with a generous spoonful of the cooled apple mixture.
06 - Brush the exposed pastry edges with the beaten egg to ensure a golden, shiny finish after baking.
07 - Bake on the center rack for 18 to 22 minutes, rotating the pan halfway through, until the pastry is puffed and deep golden brown.
08 - Allow the danishes to cool on the pan for 5 minutes. Whisk together the powdered sugar and enough milk or lemon juice to reach a drizzling consistency. Use a spoon to zigzag the glaze over the cooled danishes. Serve warm or at room temperature.