Heat oven to 350°F and line two baking sheets with parchment.
Toss the diced apple with lemon juice; blot well with paper towels to remove excess moisture.
Whisk flour, cornstarch, baking soda, baking powder, cinnamon, nutmeg, and salt in a bowl.
Cream butter, brown sugar, and granulated sugar until light and fluffy, about 2 minutes.
Beat in the egg and vanilla until smooth, scraping the bowl as needed.
Stir the dry ingredients into the butter mixture just until no dry streaks remain.
Fold in the apples, caramel bits, and pecans if using. Chill the dough for 15 minutes.
Scoop 2-tablespoon portions onto sheets, spacing 2 inches apart.
Bake 10–12 minutes, until edges are set and centers look slightly soft.
Cool 5 minutes on the sheet, then move to a rack. Sprinkle flaky salt while warm if desired.