Apparently, the origin of this was a quirk of Welsh law (while under English rule). Sheep rustling was a crime subject to summary execution by the local lord. However, “having a carnal relationship with livestock” was dealt with by the local bishop/church official.
Given the choice between being hung from the nearest tree, or lying through your teeth and dealing with the local (Welsh) priest, it’s obvious why the English landlords were surprised by the number of sheep shagging Welshmen they encountered.