Multiple generations of grain aggregation in different environments preceded solar system body formation