According to the National Hot Dog and Sausage Council there’s a good reason for the discrepancy. For starters, distributors of hot dogs are almost always different from manufacturers of baked goods like rolls. The hot dogs are sold in packs of 10 because producers of meat (or meat-like) products selected that quantity when hot dogs started to sell at retail grocery stores in the 1940s. Oscar Mayer, which led the charge into direct-to-consumer hot dog packaging, sold hot dogs by the pound in accordance with how meat is typically priced. Having 10 dogs that weighed 1.6 ounces each seemed like the ideal distribution of weight.
Bakeries, meanwhile, have standards of their own. Buns and sandwich rolls are usually sold eight to a pack because the baking trays for the elongated buns are typically sized to fit that number. Two sets of four buns come off the tray, which is the reason why buns are often still attached to one another when you open a bag.
These standards were created independently of one another: Bakeries weren’t too preoccupied with hot dogs when they were settling on a four-roll tray standard, and hot dog manufacturers weren’t thinking about how difficult it would be for bakeries to break from their conveyor system to offer 10 buns to a pack.