The muscular system is controlled by the nervous system.
Muscles have no control of their own.
The obvious conclusion to draw is that muscles get shortened because the nervous system is stimulating them to contract. The lasting changes that result from stretching are therefore generally unpredictable and unstable. Athletes and dancers attempt to stretch their hamstrings to avoid injury. Clearly, whatever benefits stretching confers, it has some significant limitations. As anyone who has had someone stretch their hamstrings for them knows, forcible stretching is usually a painful ordeal.