The earliest written evidence of the word "bug" used in this context is from the 19th century. By that time, most machines were made from metallic parts.
Of course, more primitive machines were still using wooden parts, as they do today! Of course, the word "bug" might have been used in this context centuries earlier, without producing any written records!
But let's not kid ourselves. OP had no evidence of their theory whatsoever. They just made up a story.
I can make up an equally "likely" theory: maybe people were often saying "oh, I've made a big mistake", and "big mistake" turned into "bug mistake", which was then shortened to "bug".