Rudyard Kipling, it would seem, believes that “rub-a-dub” refers to a way of ringing a bell. Dan and Harvey are trawling in a small dory, when heavy weather blows up unexpectedly:
“Take a-holt here, an’ keep ringin’ steady,” said Dan, passing Harvey the lanyard of a bell that hung just behind the windlass.
Harvey rang lustily, for he felt two lives depended on him….
“Clang! cling! clang” Harvey kept it up, varied with occasional rub-a-dubs, for another half-hour.
Captains Courageous, chap. III
However, my researches have turned up only the nursery rhyme, which comes dripping with the usual smarmy gossipy backstory from the 14th century.
Now, a close reading might suggest a sniggering joke on Kipling’s part (and indeed, he uses the word “tub” several times in the passage, referring to containers of trawling gear), but I am not sufficiently familiar with his work to infer whether he is capable of slipping one in, as it were.