Combine the sugar, flour, and salt. Whisk the sugar, flour, and salt together in a medium saucepan. Gradually whisk in the milk until combined, then place the pan over medium heat. Heat the mixture until thickened.
Whisk the milk mixture into the yolks. Place the egg yolks in a medium bowl. While whisking the yolks vigorously, slowly drizzle in the milk mixture. Return everything back to the heat. Cook, stirring constantly, for 2 minutes more.
Stir in the vanilla and butter.
Make the first cookie layer. Sprinkle half of the crumbled vanilla wafers into a baking dish.
Top with half the bananas. Place half of the sliced bananas over the crumbled wafers.
Top with half the pudding. Dollop half of the warm pudding over the bananas.
Repeat layering once more with the remaining wafers, bananas, and pudding.