The word Yankee was around well before the Brits started calling them Yankee Doodles.
Dictionary.com says:
“175060, Americanism ; perhaps back formation from Dutch Jan Kees John Cheese, nickname (mistaken for plural) applied by the Dutch of colonial New York to English settlers in Connecticut.”
So, yes, insult originally intended, but only John Cheese.
Dictionary does suggest that “Doodle” may well refer to the male member.
Like many insults, what was originally intended as an insult became a word of pride to those insulted—like the words “Quaker” and “Shaker.” Or, more recently, Birther. Or, when the Brits spoke of Yanks during the Second World War, it was kind of an endearing insult.
You are both correct that the term “Yankee” had been around for a while. However, the connotation of “yanking” and the pairing with “doodle” (which you correctly pointed out was already on the endless list of synonymns for the male member) was what made it stick with British soldiers in 1776.