How much bandwidth do you suppose DockerHub uses? I can't see it being any less than 10gigabit, probably more like 100gigabit. Just the cost of that transit is likely in the $600-6,000/mo range. Then you need to factor in the additional costs for storage and compute to serve it, switching gear, and management and maintenance. That's probably at least as much as transit.
They aren't likely able to go for peering arrangements ("free" bandwidth) because their traffic is likely very asymmetric, and that doesn't save the management/storage/compute costs.
I don't know what Docker's financials are, but I can imagine, as a business owner myself, situations where it was lean enough that that sort of cost could mean the difference between running the service and not.
The bigger the service, the more financial incentive they have to be smart and not pay absurd prices for things, since they can give themselves higher profit margins by controlling their costs.