Preheat the oven to 400°F. Lightly grease a mini muffin tin with nonstick spray or butter.
Open the can of apple pie filling and scoop the apples into a bowl, leaving behind some of the extra syrupy liquid. You do not need to drain the filling completely. You just want the apples coated, not swimming in sauce.
Chop the apple pieces into smaller bits so they fit easily inside the mini puff pastry cups. Stir in the cinnamon, nutmeg, salt, lemon juice, and vanilla extract, if using. If the filling still seems very watery, stir in 1 to 2 teaspoons of cornstarch or flour.
Gently unfold the thawed puff pastry sheets. If needed, roll them out just slightly. Cut each sheet of puff pastry into 12 equally sized squares/rectangles (so you should have 24 total).
Gently press one puff pastry square into each cup of the greased mini muffin tin. Let the corners stick up slightly. They will puff and brown as they bake.
Poke the bottom of each puff pastry cup once or twice with a fork. This helps keep the bottom from puffing too much under the filling.
Spoon about 1 1/2 to 2 teaspoons of the seasoned apple filling into each pastry cup. Try to keep the filling below the top edge of the pastry so it does not bubble over too much.
In a small bowl, whisk together the egg and 1 tablespoon of water or milk until a smooth egg wash forms
Lightly brush the exposed puff pastry edges and corners with egg wash. Try not to let the egg wash pool in the muffin tin or drip too much into the filling.
Bake for 14 to 18 minutes, or until the pastry is puffed and golden brown.
Let the mini apple pie bites cool in the pan for 5 to 10 minutes before gently lifting them out. The filling will be very hot, and it will set up slightly as it cools.