Age distributions for multiphase branching processes and their applications