There is probably no way to verify this, but this is what my grandmother told me about this song.
When I was very little, my mother (who is from Spain) would sing this to me in bed before I fell asleep and when I would stay with my grandmother, she would also.
I remember asking my abuela about the song because it was such a weird song to sing to a kid and she told me that her mother and grandmother used to sing it to her because “a long time ago, there was a cockroach infestation in Spain and kids would wake up screaming because they would find them crawling all over their bodies and faces. The mom’s would sing the song to the kids to calm them down, letting the kids believe the cockroaches couldn’t climb into their beds because of the broken legs”.
After reading your article about this, it sounds like a very valid story, because, really, what mom or grandmother would lie to their kids?
I hope someone can verify this!