I think this has to do with the way structure damage is reported. The shipyard might be in the same category as a wall so when they destroyed the shipyard the ship got destroyed because that is what happens so then the ship gets reported as destroyed by the shipyard.