Trees were being grafted from varieties with thorns. Once the top died the roots would shoot up a sprout that could breed thorns.
There was also cross breeding with other thorn less varieties but I believe this was mostly after the damage had been done.