Warm the base: In a medium saucepan, whisk almond milk, heavy cream, cocoa powder, sweetener, espresso powder, and salt over medium heat. Keep whisking until the cocoa dissolves and the mixture steams, about 3–4 minutes. Do not boil.
Temper the yolks: In a small bowl, whisk the egg yolks.
Slowly ladle in about 1/2 cup of the hot chocolate mixture while whisking constantly. Then pour the tempered yolks back into the saucepan, whisking well.
Thicken the pudding: Reduce heat to medium-low. If using xanthan gum, sprinkle it in while whisking to avoid clumps.
If using gelatin, stir in the bloomed mixture until dissolved. Cook 3–5 minutes, whisking, until the pudding coats the back of a spoon.
Finish the chocolate layer: Remove from heat. Whisk in butter and vanilla until smooth and glossy.
Taste and adjust sweetness if needed.
Chill the chocolate layer: Divide the pudding among 6–8 small dessert cups or pour into an 8x8-inch dish. Press plastic wrap directly on the surface to prevent skin. Chill 1–2 hours until set.
Whip the cream: In a cold bowl, beat heavy cream, sweetener, vanilla, and a small pinch of salt to soft peaks.
For a cleaner look, stop at soft-medium peaks; for a thicker layer, go to medium-firm peaks.
Layer and finish: Spoon or pipe the whipped cream over the set chocolate pudding. Smooth the top. Add optional toppings like dark chocolate shavings or berries.
Chill and serve: Chill at least 30 minutes more for clean layers.
Serve cold and store leftovers covered in the fridge.