Contractile function of striated muscle cells depends crucially on the almost crystalline order of actin and myosin filaments in myofibrils, but the physical mechanisms that lead to myofibril assembly remains ill-defined. Passive diffusive sorting of actin filaments into sarcomeric order is kinetically impossible, suggesting a pivotal role of active processes in sarcomeric pattern formation. Using a one-dimensional computational model of an initially unstriated actin bundle, we show that actin filament treadmilling in the presence of processive plus-end crosslinking provides a simple and robust mechanism for the polarity sorting of actin filaments as well as for the correct localization of myosin filaments. We propose that the coalescence of crosslinked actin clusters could be key for sarcomeric pattern formation. In our simulations, sarcomere spacing is set by filament length prompting tight length control already at early stages of pattern formation. The proposed mechanism could be generic and apply both to premyofibrils and nascent myofibrils in developing muscle cells as well as possibly to striated stress-fibers in non-muscle cells.