For the cake: Preheat the oven to 350 degrees F. Butter an 8-by-2-inch round cake pan and line it with parchment.
In a medium bowl, whisk together the flour, cocoa powder, baking soda, baking powder and salt. In a large bowl, whisk together the sugar, melted butter and eggs. Alternate whisking the flour mixture and the buttermilk and coffee into the sugar and egg mixture, starting and ending with the flour mixture. Transfer the batter to the prepared pan.
Bake until a toothpick inserted into the center comes out with moist crumbs attached, about 40 minutes. Transfer to a rack to cool for 20 minutes, then flip the cake out onto the rack to cool completely, about 1 hour.
For the custard: Put the chocolate and butter in a medium bowl and set a fine-mesh sieve over it. In another medium bowl, whisk the sugar, cornstarch, salt and egg yolks together until smooth.
Bring the milk and the cocoa powder to a simmer in a small pot. While whisking, add about 1/4 cup of the hot milk mixture to the yolk mixture. Repeat this process until the two are completely combined. Return the mixture to the pot and heat over medium while stirring constantly. Bring the custard to a boil and cook, whisking constantly, for 1 to 2 minutes. Immediately pour the custard through the sieve into the bowl with the chocolate. After the butter and chocolate have melted, whisk until smooth. Cover with a piece of plastic wrap, making sure the plastic touches the surface of the custard, and chill until completely cold, about 1 hour.
For the glaze: Put the chocolate in a medium heatproof bowl. Bring the cream to a boil in a small saucepan and pour it over the chocolate. Let the mixture stand until smooth and then whisk it to combine. Whisk in the salt. Chill the glaze, stirring occasionally, until it is thick enough to spread over the top of the cake, 20 to 30 minutes.
To assemble the cake, cut it in half crosswise. Spread the chocolate custard evenly over the bottom half, and replace the top half. Spread the glaze evenly over the top.