In the bowl of a stand mixer fitted with the paddle attachment, beat the eggs at low speed, increasing to medium. Beat in the applesauce, vegetable oil, and vanilla extract, scraping down the sides occasionally. With the mixer on low speed, beat in the carrots. Gradually add the dry ingredients, beating just until combined, scraping down the sides of the bowl as needed. Remove the mixer bowl and fold in the raisins using a spatula or a wooden spoon.

Divide the mixture evenly between the two prepared cake pans. Rap the filled pans a few times against a counter to settle the batter and remove any air bubbles. Bake until the cake springs back when touched and a cake tester inserted into the cake comes out with just a few crumbs clinging to it, 20 to 25 minutes. Cool in the pans on wire racks for about 10 minutes. Then turn the cakes out onto the wire racks to cool completely.

For the frosting: Place the cream cheese and the butter in the bowl of a stand mixer fitted with the whisk attachment. Beat on medium speed until fluffy and well combined. With the mixer on low speed, gradually add the confectioner’s sugar, mixing well after each addition, until the frosting has a fluffy but spreadable consistency. Beat in the maple extract.

Place one cake layer on a serving plate and spread icing over the top. Place the second layer on top, then frost the top and sides of the cake. Sprinkle the walnuts over the top of the cake, if using.