Line 2 baking sheets with parchment. Place the caramel squares in the fridge or freezer for 10 minutes so they’re firm but not rock hard. Heat the oven to 360°F (182°C).
Brown the butter: Melt butter in a light-colored saucepan over medium heat, stirring, until the milk solids turn amber and smell nutty, 5–7 minutes. Scrape into a large bowl and cool until warm, not hot, 5–8 minutes.
Whisk in both sugars, espresso powder, and vanilla until glossy and slightly thickened, about 1 minute. Whisk in the eggs one at a time until the mixture is smooth and shiny.
In a separate bowl, whisk together the flour, cocoa powder, baking soda, baking powder, and fine sea salt.
Add the dry ingredients to the butter mixture and fold with a spatula until a few dry streaks remain. Stir in the milk to loosen the dough, then fold in the chocolate chunks just until evenly distributed.
Cover and chill the dough for 20–30 minutes to firm slightly for easier handling.
Scoop about 1 1/2 tablespoons of dough (medium cookie scoop). Flatten gently in your palm, set a chilled caramel in the center, and wrap the dough fully around it, pinching to seal. Roll into a smooth ball and place seam-side down on the prepared sheets, spacing about 3 inches apart.
Bake 9–11 minutes, rotating the pans halfway, until the edges are set and the centers look puffed and soft. Lightly tap the pan once on the rack to settle the cookies.
While hot, sprinkle the tops with flaky sea salt. Cool on the sheets for 5 minutes, then transfer to a wire rack to finish cooling so the caramel sets inside.