In order to maintain homeostasis, mature cells removed from the top compartment of hierarchical tissues have to be replenished by means of differentiation and self-renewal events happening in the more primitive compartments. As each cell division is associated with a risk of mutation, cell division patterns have to be optimized, in order to minimize or delay the risk of malignancy generation. Here we study this optimization problem, focusing on the role of division tree length, that is, the number of layers of cells activated in response to the loss of terminally differentiated cells, which is related to the balance between differentiation and self-renewal events in the compartments. Using both analytical methods and stochastic simulations in a metapopulation-style model, we find that shorter division trees are advantageous if the objective is to minimize the total number of one-hit mutants in the cell population. Longer division trees on the other hand minimize the accumulation of two-hit mutants, which is a more likely evolutionary goal given the key role played by tumor suppressor genes in cancer initiation. While division tree length is the most important property determining mutant accumulation, we also find that increasing the size of primitive compartments helps to delay two-hit mutant generation.