Apples take a while to cook through, especially in a cake. They will also exude some liquid while they are baking. When you partially cook the apples until they soften, this allows you to bake the cake just until it's tender and soft, not overcooked and dense if you had to wait for raw apples to cook all the way through. Cooking the apples in butter, brown sugar, lemon juice and vanilla will also give them so much flavor and give the apple topping a beautiful glossy look too.