In the original script, it was "Stars and Stripes Forever" that drove Curly Howard crazy, but it was changed when it was decided that Larry Fine would play the tune on the violin. Larry himself chose "Pop-Goes-the-Weasel" because the other song didn't sound right when played on the violin.
This is the only Three Stooges short that the stooges (Moe Howard, Larry Fine and Curly Howard) wrote entirely themselves.