I remember this also happened to me with a catapult before. Don't recall any incidences with rams though.
To recreate the bug: start deploying trebs with 1 sec of difference on two chars. Only the first one gets created.
Suggested solution: only consume when area check (not too close to siege) doesn't fail
Screenshots:
1. starting to craft, my treb circled in my backpack
2. first treb is up, second is still in the making
3. craft fails and treb is consumed from my backpack (red circle)
![Image](https://i.imgur.com/adaNEb7.jpg)