While this is a interesting point, grammarians will bristle at such an imprecise use of 'it', which should unambiguously refer to one antecedent.
Professional writers, editors, and teachers of language would be perfectly fine with those sentences, because they understand language as being made up of syntax AND semantics.