Aquagility - I love your explanation, which I've never heard before. All that the Oxford Dictionary of Nursery Rhymes has to say about it is:
Edith Sitwell in Fanfare for Elizabeth (1946) pictures Lady Bryane, governess-in-ordinary to the young Princess Mary and then to Elizabeth,singing this song to her charges, and remembering a black and terrible shadow, the shadow of Juana of Castile the mad 'King of Spain's daughter', who visited the court of Henry VII in 1506. This picture was probably inspired by J O Halliwell's suggestion that Juana of Castile is here celebrated. Whether there are grounds for the theory is not clear.
The rhyme is said to be the favourite recitation of the Shakespearean actress Dame Sybil Thorndike.