I stress I am in no way an expert in insurance, but from looking at the clauses it does seem that the Employer is justified as:
- they have "costs payable" arising from or in connection with you (not) Providing the Works where this means doing the work "in accordance with this contract". Defects are not in accordance with the contract. And you indemnify them for these amounts under clause 81.2
- further, as you point out, in clause 50.3, the Employer can deduct from amounts due, the amounts to be "paid by" the Contractor.
- they have "costs payable" arising from or in connection with you (not) Providing the Works where this means doing the work "in accordance with this contract". Defects are not in accordance with the contract. And you indemnify them for these amounts under clause 81.2
- further, as you point out, in clause 50.3, the Employer can deduct from amounts due, the amounts to be "paid by" the Contractor.