No, I've seen barbs on huts many times.
I know exactly the code mechanics about this.
To put in few words, AI units have a sequence of behaviours put in priorities (as read downward in the code) and if we see a match between conditions in which the unit is, the code is not rolling more for the unit and we return to the game with a particular behavior.
In term of priorities, guarding huts have second priority, just after guarding a barb city if no unit is protecting it.
Typical barb agressions are located more downward, which makes a guarding barb inoffensive if some unit passes by the guarded hut.