The sentiment is surely as timeless a grumble as any. Pour encourager les autres, borrowed from Voltaire, is used often enough to find its way into dictionaries (e.g. MW, OLD). Taken literally, it would map more closely to the meaning of make an example of someone to use a modern idiom. Candide (1759), however, is a work of satire, and the phrase is used ironically.

For the phrasing as X until morale improves, however, there doesn't seem to be any clear origin, nor for variations floating around like floggings will continue until morale improves (which I have seen on T-shirts as FWCUMI) or all leave has been canceled until morale shall have improved, among others.

Morale in the sense of one's confidence and good emotional state is attested only from the early 19th century, according to the OED. Prior to that, the predominant meaning would have been morality. As such, I think the attribution to Captain Bligh of the Bounty is probably apocryphal, especially as there appears to be no such direct quotation from him or from the mutineers, even in their Hollywood adaptations.

A military origin is possible. There is an entry in Robert Heinl's 1966 Dictionary of Military and Naval Quotations, published by the U.S. Naval Institute:

There will be no liberty on board this ship until morale improves. — Excerpt from Plan of the Day, USS * * *

A cartoon captioned … and all liberty is canceled until morale improves appears even further back in All Hands, a magazine published by the U.S. Bureau of Naval Personnel, from November 1961.

There are unattested attributions on the web to some or other never-named World War II Japanese naval commander. That too, seems likely to be apocryphal. But such a tale could have been spun by one sailor and then popularized through the ranks, eventually making its way into print and vernacular usage.