01 - Preheat oven to 400°F. Line a baking sheet with parchment paper and set aside.
02 - In a medium 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 reduced into a syrupy glaze. Remove from heat and let cool completely.
03 - In a mixing bowl, beat together the softened cream cheese, granulated sugar, and vanilla extract until smooth and creamy. Set aside.
04 - Unfold the thawed puff pastry onto a lightly floured work surface. Gently roll to smooth out any creases. Using a sharp knife or pastry wheel, 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 about 1/2 inch from each edge, being careful not to cut all the way through. Prick the inner square several times with a fork to prevent excessive puffing.
06 - Spread a generous tablespoon of the cream cheese filling in the center of each pastry square, staying within the scored border. Spoon an equal portion of the cooled apple mixture over the cream cheese layer.
07 - Brush the exposed pastry edges with the beaten egg to ensure a deep golden finish during baking.
08 - Bake on the center rack for 18 to 22 minutes, rotating the pan halfway through, until the pastry is puffed and deeply golden brown. Transfer to a wire rack to cool slightly.
09 - In a small bowl, whisk the powdered sugar with milk or lemon juice, adding liquid gradually until a drizzle consistency is reached. Use a spoon to zigzag the glaze over the slightly cooled danishes. Serve warm or at room temperature.