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
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.