01 - Preheat oven to 400°F. Line a baking tray with parchment paper and set aside.
02 - In a skillet over medium heat, melt the butter. 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 - On a lightly floured surface, roll out the puff pastry sheet to smooth any creases. Cut into 8 equal squares. Transfer the squares to the prepared baking tray. Using a sharp 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 excessive puffing.
05 - Spread a generous spoonful of the cream cheese filling in the center of each pastry square, staying within the scored border. Top with a spoonful of the cooled apple mixture, distributing evenly among all 8 pastries.
06 - Brush the exposed pastry edges with the beaten egg to ensure a deep golden, glossy finish after baking.
07 - Bake on the center rack for 18 to 22 minutes, rotating the tray halfway through, until the pastry is puffed and deeply golden brown.
08 - Allow the danishes to cool on the tray for 5 to 10 minutes. In a small bowl, whisk together the powdered sugar with enough milk or lemon juice to reach a drizzling consistency. Use a spoon to zigzag the glaze over each cooled danish.
09 - Serve warm or at room temperature. Best enjoyed the same day.