"More X than you can shake a stick at" means more than you can count. I don't know the origin but a as a wild speculation picture someone using a walking stick or cane to count something. If there's lots to count, the stick will be shaking a lot for each item. If there's too much, the shaking stick won't be able to keep up.
The OED says it's a figurative use of shake but doesn't give any more on the origin other than saying it's colloquial, originally and chiefly U.S., and giving the same 1818 as in the question.
It's originally North American, but it is now commonly used and understood in the UK as well.
I found an earlier example from 1794, but without the comparative "more X than...". British Synonymy: or, An Attempt at Regulating the Choice of Words in Familiar Conversation, Volume 2 by Hester Lynch Piozzi:
THE explanation here is necessary, because the two last verbs are of an active signification, and often used as such ; to shake a stick at you for example, or shiver the glasses all to pieces ; in such sense they are not synonymous with the three first.
But this is British and the full phrase appears to be American, so they may be unconnected.
World Wide Words is usually a good source on these things. If they summarise: "nobody knows for sure", then that's probably the best we have.
However, there is this from alt.english.usage FAQ that questions whether the original meaning was different to today's:
This 19th-century Americanism now means "an abundance"; but its
original meaning is unclear. Suggestions have included "more than one
can count" (OED, AHD3), "more than one can threaten" (Charles Earle
Funk), and "more than one can believe" (Dictionary of American
English). No one of these seems easy to reconcile with all the
following citations: "We have in Lancaster as many taverns as you can
shake a stick at." (1818) "This was a temperance house, and there was
nothing to treat a friend to that was worth shaking a stick at."
(David Crockett, "Tour to the North and Down East", 1835) "Our queen
snake was [...] retiring, attended by more of her subjects than we
even dared to shake a stick at." (1843) "I have never sot eyes on
anything that could shake a stick at that." (= "set eyes on anything
that could compare with that", 1843) "[...] Uncle Sam [...] has more
acres than you can throw a stick at." (1851) "She got onto the
whappiest, biggest, rustiest yaller moccasin that ever you shuck er
stick at." (1851)
A connection with the British expression "hold (the) sticks with",
meaning "compete on equal terms with" and attested since 1817, is not
impossible.
OED staff told me: "The US usages in DAE do appear to have a different
sense to that given in OED. [...] All the modern examples I've found
on our databases conform to OED's definition so I think this is still
the most common usage."
Merriam-Webster staff opined that the "count" interpretation "works as
well for 'as many as you can shake a stick at' [...] if you take it to
mean that there is no limit to how many of the objects in question one
could shake one's stick at. [...] We would consider 'A can't shake a
stick at B' a different expression entirely, with a meaning similar to
'A can't hold a candle to B' [...]."
In their 1897 work "A Dictionary of Slang, Jargon & Cant", Albert
Barrere and Charles Leland suggested that Dutch immigrants originated
the expression using the Dutch word "schok" = "to shake or hit."
The possibility you left out is that, rather than a bowdlerisation of "butt naked," it was an eggcorn of it; however, determining whether such a change was deliberate or accidental would be nigh on impossible.
Of the three, we can argue in favour of the second, though with the people referenced being as much those of African as of American origin.
We find "buck naked" in the 19th Century.
We do not find "butt naked" during that period.
We do not find it any earlier.
We do find "buck" being used to refer to men of African and of American Indian origin.
We do find the lack of clothing in some parts of Africa and America remarked upon. We also find slaves in the American South often working with little clothing. (We also find it overstated, a cartoon of an African might likely feature them as naked even if that would be highly unlikely in the scenario depicted — we're talking about people with some pretty strong racial prejudices here).
As such, we have a group of people being called "bucks" whose nakedness is often remarked upon. This suggests that the likelihood of it being the origin is quite high.
It's far from conclusive though, and you aren't going to get any better unless you hit documents from the period and manage to track it down better yourself.
Best Answer
I suspect that the phrase "more bang for the buck" is an instance in which an actual or imagined outlier obscures the overwhelmingly more likely source of a phrase's popularization.
Analyzing the outliers from 1935 and 1940
As I noted last year in a comment beneath the posted question, the instance of the phrase that is supposedly from a 1935 article in Milestones in Analytical Chemistry (cited in the posted question) is extremely unlikely to be from 1935, given that, as the blurb for the book says,
The 1940 instance mentioned in the posted question is noted (but not linked to) by The Phrase Finder in its examination of the phrase "bang for the buck":
Unfortunately, I can find no specific information about the wording of this particular advertisement. A search of the 1940 edition of Metal Finishing: Preparation, Electroplating, Coating (volume 38 of the journal from Metals and Plastics Publications) at Hathi Trust for the words "bang AND buck" did not yield any page matches, meaning that (according to Hathi Trust's internal search engine) there are no individual pages in the issues of the magazine for 1940 that contain both the word bang and the word buck.
Since Metal Finishing was published for more than a century (its last publisher, Elsevier, announced that publication of the journal would cease as of December 31, 2013), there may be a typo in the year of publication or an OCR error leading to a misidentification of the correct year—in which case the problem isn't that there is no such advertisement, but that the advetisement appeared in a year other than 1940. But my preliminary conclusion from this brief side-investigation is that the 1940 advertisement that The Phrase Finder cites is at best unconfirmed and at worst spurious.
The avalanche of instances from 1953–1955
Even if it were confirmed as a 1940 occurrence, the cited instance of "more bang for the buck" is not obviously the direct source of phrase's subsequent popularity. That's because the normal wording of the phrase during the early 1950s, when a flurry of instances did occur, was "more bang for a buck."
Google Books and Elephind searches for "more bang for the/a/my/your/our/its/his/her/their/every buck and for "more bang for the bucks" yielded 16 matches from the period from 1953 through 1955. Here they are, in roughly chronological order.
From Stewart Alsop, "Strategic Decision," in the San Bernardino [California] Sun (December 23, 1953):
From "More Bang for a Buck," in the Madera [California] Tribune (January 19, 1954):
From "Move to Slash U.S. Defense Costs," in the [Hobart, Tasmania] Mercury (January 21, 1954):
From "Don Iddon's New York Diary: Pneumatic Drill Is The Spring Song," in the [Adelaide, South Australia] Advertiser (March 26, 1954):
From U.S. Atomic Energy Commission, In the matter of J. Robert Oppenheimer: transcript of hearing before Personnel Security Board (April 12, 1954—May 6, 1954) [combined snippets]:
From Brassey's Annual (1954) [combined snippets]:
From Machinery, volume 61, issues 1–6 (1954):
From Congressional Record, Proceedings of the Debates of the ... Congress, volume 100, part 12 (1954) [combined snippets]:
From The Commonweal, volume 61 (1954):
From The Nation, volume 178 (1954) [combined snippets]:
From Newsweek, volume 44, issues 1–13 (1954):
From "Hobby with a Bang—Big Guns in Miniature," in Popular Mechanics, volume 102 (September 1954):
From "Bolling Calls for Dispersal of Industries," in the San Bernardino, [California] Sun (February 8, 1955):
From Facts Forum News, volume 4, issue 9 (1955):
From Oil, Chemical & Atomic Union News, volumes 11–14 (1955[?]) [text not shown in snippet window]:
From National Aeronautics, volumes 31–35 (1955[?]) [combined snippets]:
As you can see, all 16 of these instances contain the phrase "bang for a buck," although they disagree about whether the lead-in to that phrase should be "bigger," "more," or "a lot of."
Early variants from the later 1950s
The first instance of "bang for the buck is from The Air Reservist (1957):
Another variant—"bang for our buck"—debuts in Industrial Marketing, volume 44, issues 1–6 (1959) [combined snippets]:
And also in 1959 we see the first match for "bang for its buck," from Barron's National Business and Financial Weekly, volume 39 (1959) [combined snippets]:
Although these instances account for a very small proportion of the total number of instances of "bang for ... buck" that reached print during the 1950s, they include the form that ultimately overcame "bang for a buck" and became the colloquial standard of the 1960s: "bang for the buck."
Conclusions
It would be difficult to find a case in which the popularization of a phrase has a clearer point of origin than "bang for the buck." The U.S. military adopted it informally in late 1953 (in the form of "more bang for a buck") and publicized it persistently for the next several years as part of the defense department's New Look strategy at the close of the Korean War.
The central premise of the New Look strategy was that nuclear weapons were a cheaper and better deterrent to military aggression than a large conventional military force would be. Literally, the "bang" was the sound of a detonating nuclear warhead; figuratively it was the promise of superior security at a lower dollar price.
The claims for earlier instances of "more bang for the buck" in 1935 or 1940 are dubious although not impossible. However, given that the wording "bang for a buck" utterly dominated the examples in print during the period 1953–1955, and given that the expression became extremely popular during this same period and never really went away (although the popular wording of the phrase definitely shifted to "bang for the buck" during the 1960s), the question of whether isolated occurrences of the phrase may also have popped up 18 or 13 years before the U.S. military slogan appeared seems effectively to be beside the point.