The phrase in question is just a cacophemism for "anything" (or "nothing," depending on whether the expression is framed affirmatively or negatively). As such, the word placed before "all" in the phrase "[cacophemism] all" can be any of an array of offensive words that grab the hearer's attention (until they become tedious and commonplace) and delight ten-year-old boys.
Allan Walker, Lexical Evidence from Folk Epigraphy in Western North America: A Glossarial Study of the Low Element in the English Vocabulary (1935) [combined snippets] explains this linguistic phenomenon as follows:
Just as taboo has its reverse in inverted taboo, so euphemism has its reverse in cacophemism or dysphemism. This is the rhetorical device of speaking ill of a thing, as in calling one's clothes duds, one's horse a nag, or any woman a bitch. The phrase to kick the bucket is a taboo-substitute for "to die" and yet at the same time it is a cacophemism.
Perhaps more specifically relevant to the OP's question is John Brophy & Eric Partridge, ed., Songs and Slang of the British Soldier, third edition (1931):
So common indeed was [fuck] in its adjectival form that after a short time the ear refused to acknowledge it and took in only the noun to which it was attached. Dean Inge recently remarked of bloody as used by working men that it means nothing, it is simply a warning that a noun is coming. So with the soldier's use of this sexual word. From being an intensive to express strong emotion it became a merely conventional excrescence. By adding -ing and -ingwell, an adjective and an adverb were formed and thrown into every sentence. It became so common that an effective way for the soldier to express emotion was to omit this word. Thus, if a sergeant said 'Get your ---ing rifles!' it was understood as a matter of routine. But if he said 'Get your rifles!' there was an immediate implication of emergency and danger.
It follows that there is no etymological explanation for the use of dick in the offensive-word slot of the cacophemism "dick all"; it's simply swapped in to provide the necessary offensive word.