Jordan–Hölder theorem for imprimitivity systems and maximal decompositions of rational functions