Preheat your oven according to the cake mix instructions, usually 175°C (350°F). Grease a 9 × 13-inch baking pan lightly with butter or cooking spray. Prepare the cake mix ingredients according to the package directions.
Place the cake mix in a large mixing bowl. Add the eggs, oil, and water specified on the package, along with the optional vanilla extract. Mix until the batter is smooth and evenly combined, taking care not to overmix.
Pour the batter into the prepared baking pan and spread it evenly. Bake for approximately 25–35 minutes, or according to the package directions. Insert a toothpick into the center; it should come out clean or with a few moist crumbs.
Remove the cake from the oven and place the pan on a cooling rack. Allow the cake to cool completely before adding the frosting. Applying frosting while the cake is warm can cause the topping to melt.
Pour the cold milk into a mixing bowl and add the instant vanilla pudding mix. Whisk according to the package directions until the mixture begins to thicken. Allow it to stand briefly if needed.
Gently fold the thawed whipped topping into the prepared pudding. Add the optional vanilla extract and mix until the frosting is smooth, light, and fluffy. Avoid vigorous mixing, which can reduce the airy texture.
Spread the pudding frosting evenly over the completely cooled cake. Use a spatula to create soft swirls or a smooth finish. If desired, sprinkle shredded coconut and chopped pecans over the top.
Drain a small amount of pineapple for decoration if needed, then arrange a few small pieces over the frosting. Avoid adding excessive liquid to the topping, as it can make the frosting watery.
Cover the cake and refrigerate for at least two hours so the frosting can set and the flavors can blend. Keep the cake refrigerated until serving, and cut it into squares with a clean knife.