Peel and core the apples, then cut them into ¼-inch slices.
Place the apples in a large bowl and toss them with the lemon juice.
Add the brown sugar, granulated sugar, cinnamon, nutmeg, salt, and ½ cup water to a large skillet or heavy-bottomed saucepan.
Cook over medium heat, stirring until the sugar begins dissolving.
Add the sliced apples and stir until they are evenly coated.
Cook for 6 to 8 minutes, stirring occasionally, until the apples begin softening around the edges.
Whisk the cornstarch with the remaining ¼ cup cold water in a small bowl.
Pour the cornstarch mixture into the apples while stirring.
Cook for another 3 to 5 minutes, stirring frequently, until the sauce is thick and glossy.
Remove the pan from the heat while the apples are still slightly firm if the filling will be baked in a pie.
Stir in the unsalted butter and vanilla extract.
Let the filling cool completely before using it in a pie or transferring it to an airtight container.