Make the pudding base: In a medium saucepan, whisk together sugar, cornstarch, and salt.
Add milk and yolks: Slowly whisk in the milk and egg yolks until smooth.
Cook the mixture: Place over medium heat and cook, stirring constantly, until the pudding thickens and coats the back of a spoon—about 8 to 10 minutes.
Add butter and vanilla: Remove from heat and stir in butter and vanilla until smooth and glossy.
Cool slightly: Let the pudding sit for 10–15 minutes to cool before layering.
Layer the pudding: In a glass dish or individual cups, spread a layer of pudding on the bottom.
Add cookies: Place a layer of vanilla wafers over the pudding.
Add bananas: Layer sliced bananas on top of the cookies.
Repeat the layers: Continue layering pudding, cookies, and bananas until the dish is full or ingredients are used up. Finish with a layer of pudding.
Top with whipped cream: Add a generous layer of whipped topping or whipped cream over the final pudding layer.
Chill the pudding: Cover and refrigerate for at least 4 hours or overnight to allow flavors to meld and cookies to soften.
Garnish and serve: Just before serving, top with crushed cookies, banana slices, or a swirl of whipped cream.