I found out that if you give yourself a stack of 64 leather caps and dye, and dye them together in a crafting table, when you shift-click them out it fills up your inventory. I ended up with a stack of around 1600 Leather Caps.
This video I made explains the bug in a bit more detail:
Something even weirder. The amount of Leather Armour produced seems to be going up in triangle numbers.
If you craft 1, you get 1 back.
If you craft 2, you get 3.
If you craft 3, you get 6.
With 4, you end up with 10.
As you can see, this is the sequence of triangle numbers. This is most definitely a bug.