Why do the counting words use a possesive particle?
I don't think の is strictly a possessive particle when addressing quantities, much like the functionally overloaded に and で.
In Japanese, you can use counting words as prefix: 500グラムのバター or suffix: バター５００グラム, so it acts more like a connective than a possessive particle anyway. If you look at 「全てのバター」 ("the butter of all" = all the (blocks of) butter) vs. 「バターの全て」 ("all of the butter") you might even /feel/ that there is a difference, though I think that difference is too obscure to make use of it.
Possessive particles are well-defined on (a subset of) the domain of (NP,NP), e.g. 「家族の友達」 and have their syntax reused for other domains, e.g. 緑の花 (the flower of green), 一個のパン (the bread of one).
It is possible to think of の as a substitute topic marker (は). Such is the reasoning for these phrases: