Place the eggs, granulated sugar, all purpose flour, and salt in a medium saucepan.
Whisk until smooth and evenly combined.
Gradually add the whole milk while whisking continuously.
Place the saucepan over medium low heat.
Cook while stirring constantly until the custard thickens enough to coat the back of a spoon.
Remove the saucepan from the heat.
Stir in the unsalted butter and vanilla extract until smooth.
Cover the surface of the custard directly with plastic wrap to prevent a skin from forming.
Refrigerate until completely cold.
Slice the ripe bananas into even rounds.
Prepare the vanilla wafers for layering.
If using heavy cream, pour it into a chilled bowl.
Beat until soft peaks form and set aside.
Spread a layer of chilled pudding in the bottom of a trifle bowl.
Arrange a layer of vanilla wafers over the pudding.
Add a layer of sliced bananas.
Repeat the layers of pudding, wafers, and bananas until all ingredients are used.
Finish with a layer of pudding.
Add the whipped cream on top if using.
Cover the trifle.
Refrigerate for at least 4 hours to allow the wafers to soften and the flavors to blend.
Serve chilled.