codswallop
Does this by chance have to do with codpiece?


Well, Bob, it might do, depending on the value ascribed to its contents!

Main Entry: cod·piece
Pronunciation: 'käd-"pEs
Function: noun
Etymology: Middle English codpese, from cod bag, scrotum (from Old English codd) pese piece
Date: 15th century
: a flap or bag concealing an opening in the front of men's breeches especially in the 15th and 16th centuries


For Brits, "that's a load of codswallop" would more commonly (and vulgarly) be put as "that's a load of b*llocks". So you may have hit the nail on the head

just noticed tsuwm's quinion reference. Yeah, I think it is folk etymology, and the nail's still hit on the head just above ("wallop" doesn't just mean booze!)