Heat 4 cups of the milk in a large saucepan over medium heat until steaming. Whisk the sugar, cornstarch and 1/2 teaspoon salt together in a large bowl; whisk in the egg yolks and the remaining 1/2 cup milk. Whisk half of the hot milk into the egg mixture until smooth, and then gradually whisk the egg mixture back into the pan. Cook over medium heat, whisking constantly, until the mixture boils. Once it boils, continue to whisk over medium heat until it has thickened to a pudding-like consistency, 3 to 4 minutes. Remove from the heat and whisk in the mascarpone cheese until melted. Transfer to a bowl or baking dish (a 9- by 13-inch baking dish will speed up the cooling process) and cool slightly, stirring a few times to prevent a skin from forming. Place a piece of plastic wrap directly on top of the pudding and refrigerate until completely cooled and thickened, about 2 hours.
To assemble, loosen the chilled pudding by whisking it vigorously until smooth and creamy. Stir the espresso and coffee liqueur together in a small bowl. Dip some vanilla wafers in the espresso mixture, soaking completely for a couple of seconds. Stand the soaked cookies around the bottom of a 3-quart trifle dish to make a decorative ring.
Dip more vanilla wafers and stack two layers of soaked cookies on the bottom of the dish within the ring of standing cookies. Spoon 2 cups of pudding on top of the cookies. Smooth the pudding to the edge of the dish with a small spatula. Layer half of the banana slices evenly over the pudding. Repeat with two more layers of soaked cookies, 2 cups of pudding and the remaining bananas.
Top with the remaining cookies and then the remaining pudding. Place a piece of plastic wrap directly on top of the pudding. Refrigerate for at least 4 hours or up to overnight.
Lightly dust with unsweetened cocoa powder just before serving.