Here's an explanation I'm making up off the top of my head, but it makes sense to me as I write it!
I think it has to do with object offsets that tie back to their transform matrices. When you glue an object to another object, it is positioned in world coordinates according to where it's parent object is and it is offset by it's own local coordinates. You've already seen this behavior, that's how you're able to place a turret offset from the ship. The glued object and the parent object are then rendered together.
When the parent is hidden, the rendering for the parent is stopped but the rendering for the glued object is not. The transformation information is updated so the parent can have a virtual new position (this is how collision detection with the parent can occur even though it's invisible), but since it is not rendered, the visual position of it and it's glued object do not update. When the parent becomes visible again, it's rendering information is updated and thus the glued object's rendering is also updated.
There are many alternatives. A simple one might be to hide object 16 also if object 6 is hidden or off screen.
Another option is to add the turret as a limb instead of gluing it.
You can also position the turret and offset it without gluing it and control it's position and orientation based on the position of object 6.
You could even have multiple models with different weapons already added as part of the model and load and delete the models as you need them.
These are just a few options off of the top of my head.
Enjoy your day.