The riddle has been solved according to Vinepair.
Hot dogs usually weigh 1.6 ounces each and meat is sold by the pound, so producers sell them 10 to a package which translates to one pound. Companies started selling them this way in the 1940s according to Reader's Digest. Baking machinery is set to produce four buns and bakers started packing two sheets of buns to a package which amounts to eight buns. If they packed 10 buns into a package, the package would be uneven and not stack properly on store shelves.
Heinz Ketchup tried to solve the problem in 2022 by offering 10-bun packs in a collaboration with Wonder Bread but there’s only one problem – they are only currently available in Ontario, Canada. The long and short of it is that there still is no solution to match the number of hot dogs and hot dog buns, but you could buy four packages of hot dogs and five packages of buns to make a total of 40 matching pairs.