Meat lobby groups fought a “hard and dirty” war against a planned EU ban on caged hens and pigs that has now been shelved, the Guardian can reveal.