Preheat your oven to 350°F (177°C). Line a 9x13-inch metal or glass pan with parchment paper, leaving a little overhang on the sides so you can lift the bars out cleanly once they've cooled.
In a large bowl, whisk together the flour, baking soda, ginger, cinnamon, allspice, cloves, nutmeg, black pepper, and salt until evenly combined.
In a separate bowl, whisk the warm melted butter, brown sugar, granulated sugar, and molasses together until smooth. Whisk in the egg and vanilla. Work quickly here, mixing the sugars and molasses into the butter while it's still warm is what keeps the bars thick and chewy instead of cakey.
Pour the wet ingredients into the dry ingredients and stir until no streaks of flour remain. The dough will be thick, shiny, and a little slick, almost like it's not quite enough to fill the pan. That's normal. Press it evenly into the prepared pan with your hands or the back of a spatula. The layer will look thin going in, but the bars rise as they bake.
Bake for 23 to 26 minutes, until the top is set and a toothpick inserted in the center comes out with just a few moist crumbs, not wet batter. Err on the side of underbaking here. The bars firm up a lot as they cool, so if you wait until the top looks fully set in the oven, they'll be dry once they've cooled.
Let the bars cool in the pan on a wire rack for at least 1 hour before frosting. If you frost them while they're even slightly warm, the frosting will slide right off instead of setting on top.
Beat the cream cheese and butter together until completely smooth, about 2 minutes. Add the confectioners' sugar, the pinch of ginger, cinnamon, and allspice, and the vanilla, then beat until creamy and well combined.
Spread the frosting evenly over the cooled bars and add sprinkles if you're using them. Refrigerate for 30 minutes to let the frosting set before slicing. Lift the whole slab out of the pan using the parchment overhang, then cut into squares.