  Kuiper belt objects show an unexpected trend, whereby large bodies have
increasingly higher densities, up to five times greater than their smaller
counterparts. Current explanations for this trend assume formation at constant
composition, with the increasing density resulting from gravitational
compaction. However, this scenario poses a timing problem to avoid early
melting by decay of $^{26}$Al. We aim to explain the density trend in the
context of streaming instability and pebble accretion. Small pebbles experience
lofting into the atmosphere of the disk, being exposed to UV and partially
losing their ice via desorption. Conversely, larger pebbles are shielded and
remain more icy. We use a shearing box model including gas and solids, the
latter split into ices and silicate pebbles. Self-gravity is included, allowing
dense clumps to collapse into planetesimals. We find that the streaming
instability leads to the formation of mostly icy planetesimals, albeit with an
unexpected trend that the lighter ones are more silicate-rich than the heavier
ones. We feed the resulting planetesimals into a pebble accretion integrator
with a continuous size distribution, finding that they undergo drastic changes
in composition as they preferentially accrete silicate pebbles. The density and
masses of large KBOs are best reproduced if they form between 15 and 22\,AU.
Our solution avoids the timing problem because the first planetesimals are
primarily icy, and $^{26}$Al is mostly incorporated in the slow phase of
silicate pebble accretion. Our results lend further credibility to the
streaming instability and pebble accretion as formation and growth mechanisms.
