Sadly this is exactly what should be done in most contracts. (In a hypothetical alternate world where law worked more like OSS).
Of course it was unethical for them to do it without telling you and trying to charge you $5k for it, but law would be a heck of a lot cheaper if openness and code re-use were the default.
The contract may well be copyright by the competing service provider's law firm. You can't just copy&paste it. It's especially worrying when law firms specialising in IPR issues do this.