Prep the pan and oven: Heat the oven to 350°F (175°C). Line a 9x13-inch baking pan with parchment, leaving overhang on two sides for easy lifting. Lightly grease the parchment.
Prep the apples: Peel (optional), core, and chop the apples into small 1/2-inch cubes.
Toss with lemon juice, 1 teaspoon cinnamon, a pinch of salt, and the cornstarch. Set aside while you make the dough.
Cream the butter and sugars: In a large bowl, beat softened butter with brown sugar and granulated sugar until light and fluffy, about 2 minutes. Add eggs and vanilla and beat until smooth.
Mix the dry ingredients: In a separate bowl, whisk flour, baking powder, baking soda, 1 teaspoon cinnamon, nutmeg (if using), and 3/4 teaspoon kosher salt.
Make the dough: Add the dry ingredients to the wet ingredients and mix on low just until no dry streaks remain.
Fold in oats or pecans if you like a little texture.
Build the base: Press about two-thirds of the dough into the prepared pan in an even layer. It helps to lightly dampen your fingertips or use a small offset spatula.
Add the apples: Scatter the seasoned apples evenly over the dough. Gently press them in so they stick and bake evenly.
Drizzle the caramel: Warm the caramel until pourable but thick.
Drizzle generously over the apples, aiming for even coverage. Reserve a little for finishing, if you want a glossy top.
Top with remaining dough: Drop the remaining dough in small spoonfuls over the caramel layer. It won’t fully cover, and that’s perfect—those gaps let caramel bubble through.
Bake: Bake 30–38 minutes, until the top is golden and the edges are set.
The center should look slightly soft but not jiggly. If your oven runs hot, start checking at 28 minutes.
Cool completely: Let the bars cool in the pan on a rack. For the cleanest slices, chill for 45–60 minutes after they reach room temperature.
Drizzle with any remaining caramel and a pinch of flaky sea salt.
Slice and serve: Lift out using the parchment overhang. Cut into 16–24 bars, depending on how generous you want to be.