Rocky planetesimals in the early solar system melted internally and evolved chemically due to radiogenic heating from Al-26. Here we quantify the parametric controls on magma genesis and transport using a coupled petrological and fluid mechanical model of reactive two-phase flow. We find the mean grain size of silicate minerals to be a key control on magma ascent. For grain sizes larger than $approx$ 1 mm, melt segregation produces distinct radial structure and chemical stratification. This stratification is most pronounced for bodies formed at around 1 Myr after formation of Ca,Al-rich inclusions. These findings suggest a link between the time and orbital location of planetesimal formation and their subsequent structural and chemical evolution. According to our models, the evolution of partially molten planetesimal interiors falls into two categories. In the magma ocean scenario, the whole interior of a planetesimal experiences nearly complete melting, which would result in turbulent convection and core-mantle differentiation by the rainfall mechanism. In the magma sill scenario, segregating melts gradually deplete the deep interior of the radiogenic heat source. In this case, magma may form melt-rich layers beneath a cool and stable lid, while core formation would proceed by percolation. Our findings suggest that grain sizes prevalent during the internal heating stage governed magma ascent in planetesimals. Regardless of whether evolution progresses toward a magma ocean or magma sill structure, our models predict that temperature