Place a sieve over a large measuring cup or bowl; set aside
In a medium saucepan, bring 2 1/4 cups of the milk to a boil. Meanwhile, in a large heat-proof bowl, combine sugar, cornstarch, and salt. Scrape vanilla bean seeds into the sugar mixture. Place the empty vanilla pod into the saucepan with the heating milk. (If you’re replacing the vanilla bean with extract, do not add it yet.) Very gradually, whisk the remaining 3/4 cup milk into the sugar-cornstarch mixture. Add the milk a little at a time and stir constantly so that lumps do not form. Whisk in the egg.
Once the milk has boiled, slowly add it to egg-mixture a little bit at a time, stirring constantly (using a ladle can be helpful). Be sure to work gradually so that the egg does not scramble. Once all of the heated milk had been added, pour all of the mixture back into the saucepan. Stir constantly with a rubber spatula or wooden spoon and bring the mixture to a simmer (at this point, do not let it boil.) Simmer for 1 minute, stirring the whole time. If using vanilla extract, stir it in now.
Pour all of the vanilla pudding mixture through the sieve into the bowl or measuring cup (this ensure the pudding will be very smooth). Return 1/3 of the strained mixture to the saucepan (this will become the chocolate pudding). Cover the remaining 2/3 with plastic wrap so that the plastic touches the surface and refrigerate until fully set, about 2 hours.
To the remaining pudding on the stove, add the chopped chocolate and espresso powder, stirring until the chocolate melts. Pour the chocolate mixture into a separate bowl, cover with plastic wrap so that the plastic touches the surface and refrigerate until fully set, about 2 hours.
To serve: Spoon the vanilla pudding into the bottom of individual serving dishes. Top with chocolate pudding. Serve sprinkled with nuts and dollop with whipped cream.