Reproducing the assembly of massive galaxies within the hierarchical cosmogony