Origin of Doobie (joint, marijuana cigarette)
Shaggy from Scooby-Do was modeled on Maynard G. Krebs, a sidekick character in the early 60's sitcom The Many Loves of Dobie Gillis. In fact, all the main characters in Scooby-Do were modeled on Dobie Gillis characters.
Given that it was such a straight homage, if you were to try to argue a drug use subtext in the character design, you'd have to argue it from the original work. But there its generally assumed Krebs was just created originally as a generic beatnik. While drug use certainly was part of that culture, in the show most of the subtexts seemed to involve Krebs' issues with work, marriage, and the police (any mention of those three words caused him to yelp in fear, or worse).
The "Shaggy was obviously a stoner; that's why he always had the munchies!" meme is something I've mostly heard in the last decade or so, long after the show was off the air and started to be analyzed by a new generation of adults, much like the "Peppermint Patty is a lesbian" argument that I never heard until the 90's. IMHO that's just as likely people with modern sensibitiles looking at old media with their own cultural expectations, rather than the ones in place when it was created.
Of course that doesn't prevent the word from possibly having come from there. But it seems more likely as a modern myth for the word's origin than as an actual possible etymology.
Could the culprit be a TV children's cartoon; an oversized lanky Great Dane and his equally lanky and dishevelled owner, Shaggy? Perhaps not. According to one reader of Merriam-Webster (see comments), the inspiration came, yes, from a TV show but one called Romper Room. The show went on air from 1953 to 1994 and one of its stars was a bee who taught good manners to very young children. His name was Mr. Doo-Bee
A recurring character was Mr. Do-Bee, an oversized bumblebee who came to teach the children proper deportment; he was noted for always starting his sentence with "Do Bee", as in the imperative "Do be"; for example, "Do Bee good boys and girls for your parents!" There was also a "Mr. Don't Bee" to show children exactly what they should not do. Do-Bee balloons were also manufactured. Each balloon featured a painted sketch of Do-Bee on it. When the balloons were inflated and then released, they would fly around the room slowly emitting a buzzing sound. These balloons were made available for purchase to the public.
source: Wikipedia
Truth be told after a little more digging, I discovered that the M-W visitor was not alone in upholding this theory. And it's tempting to agree with them; the children who watched the show were aged between 3 and 6, and it's likely their older siblings would have kept them company in front of the TV. By the time the mid-60s arrived, you had a generation of hippie teenagers whose earliest childhood memories were linked to one of the most popular and loved TV characters, one whose main function was to teach children how to behave. From Do-Bee to doobie the path leading to the spelling variation was brief; the temptation to ridicule, trivialise and rebel against those very ideals which the US show represented must have been overwhelming for those American teenagers and youngsters. It's therefore quite possible that the slang for marijuana, doobie, was meant as an ironic and sardonic comment on how they, hippies and stoners, were behaving themselves.
From The Concise New Partridge Dictionary of Slang and Unconventional English by Terry Victor, Tom Dalzell. The following excerpt mentions also the programme Romper Room for being the possible source/inspiration for doobie, and also provides us with its alternative spellings: dooby, doob, and dub.