There have been many variant versions of this nursery rhyme recorded since people started keeping track of that sort of thing nearly 200 years ago, and references to this type of "fortune-telling" rhyme can be found as much as 250 years earlier than that.
The version used in the Blish adaptation (from an 1887 issue of
Harper's Weekly, according to
this and
this) had been incorporated into a story chapter which was published in that issue, and may have been altered to fit the needs of that particular story. I suspect its selection for inclusion in the Blish adaptation may have been for similar reasons, but that's just a guess on my part.