Comes from a ring song, popular in black communities throughout the US. There's an example on Sounds Of The South, the box set illustrating Alan Lomax's 1959 field trip throughout the South. He recorded three children in Como, MS singing and clapping a song called Mary Mack, coming real close.
Lyrics and melody also pop up in Bill Parsons's Rubber Dolly (alias Bobby Bare), B-side of All American Boy ('58). The melody of the Rubber Dolly part is similar with the one in (My) Creole Belles from 1900 (Lampe/Jens Bodewalt) and is also evident in fiddle-tunes Back Up And Push and Rubber Dolly Rag in the late 1920s. The Light Crust Doughboys sang it as Little Rubber Dolly for Vocalion in '39, Ella Fitzgerald as Wubba Dolly that same year.