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 coated in a thick 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 center area several times with a fork to prevent puffing.
06 - Spread a generous tablespoon of cream cheese filling inside the scored border of each square. Top with a spoonful of the cooled apple mixture, keeping the filling within the inner area.
07 - Brush the exposed pastry edges with the beaten egg to promote even browning during baking.
08 - Bake on the center rack for 18 to 22 minutes, rotating the tray halfway through, until the pastry is puffed and deep golden brown.
09 - Allow the danishes to cool on the baking sheet for 10 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 each danish. Serve warm or at room temperature.