Preheat your oven to 350°F (175°C). Line a 9x9 inch square baking pan with parchment paper, leaving overhang for easy removal.
Peel, core, and dice two of the apples into ½-inch cubes. For the third apple, slice it thinly for decorating the top. Toss the diced apples with 1 tablespoon of the gluten-free flour mixture to prevent them from sinking during baking.
In a medium bowl, whisk together the gluten-free flour, cinnamon, nutmeg, baking powder, and salt.
In a large bowl, whisk together the melted butter, granulated sugar, and brown sugar until smooth and slightly lighter in color. Add the eggs one at a time, beating well after each addition. Stir in the sour cream and vanilla extract until fully incorporated.
Gradually fold the dry ingredients into the wet mixture, stirring just until combined. Fold in the diced apples, ensuring they're evenly distributed throughout the batter.
Pour the batter into the prepared pan, smoothing the top with a spatula. Arrange the thinly sliced apple pieces on top in a decorative pattern.
Bake for 45-50 minutes, or until a toothpick inserted in the center comes out clean with a few moist crumbs. If the top browns too quickly, tent with foil after 30 minutes.
While the cake bakes, make your caramel sauce. In a medium saucepan with a heavy bottom, heat sugar over medium heat. Watch it carefully—when it begins to melt around the edges, gently stir with a heat-resistant spatula. Continue stirring until all sugar has melted into an amber-colored liquid (about 8-10 minutes).
Once the sugar has completely melted, add the butter pieces (be careful, it will bubble vigorously). Stir until butter is fully incorporated.
Remove from heat, slowly pour in the heavy cream (more bubbling will occur), and whisk until smooth. Add salt if making salted caramel. Let cool slightly until it reaches a pourable consistency.
Allow the cake to cool in the pan for 10 minutes, then use the parchment overhang to carefully lift it out onto a cooling rack. Let cool for another 20 minutes before drizzling with half of the caramel sauce. Reserve the remaining sauce for serving.