How did the meaning of the word “play” spread from games to things that are not games?
The first sentence of the etymonline entry has:
Middle English pleien, from Old English plegan, plegian "move lightly and quickly, occupy or busy oneself, amuse oneself; engage in active exercise; frolic; engage in children's play; make sport of, mock; perform music," from Proto-West Germanic *plegōjanan "occupy oneself about"
So it has had the senses of performing music and children's frolicking for as long as it's been a part of the English language. It's the senses related to sport and to the stage that developed later.