There are a few blanks here that prevent a full understanding of your situation. Here is what I think:
Your liability is to the company that pays you.
If they chose to distribute the web site code your company developed, that's up to them. Unless they specifically put the responsibility onto you in the contract, you cannot be expected to anticipate every eventuality. (You will examine the contract carefully, won't you?) Certainly any work done before you were officially made aware of the changing situation should be exempt.
The conpany that hired you becomes a buffer, and any change requests will have to go through them also, unless you agree otherwise. (Always insist on nominated persons as contacts in your contracts, it saves a lot of upset by filtering unauthorised change requests.)
At the same time, if you should be asked to make changes that you can deduce are from another company whose interest you were not aware of at the time the original contract was agreed, you should consider asking for more money, as this forms a variation from the original contract.
Have you asked the client how they see things? Avoid getting into a debate, just get their thoughts and then end the conversation. This will allow you to think things through and possibly resort to legal advice before you commit yourself in any way. Make sure that your client knows that this is what you are doing.
Although the client is the qwner of the code, you still have certain rights. You may be able to agree terms under which the other companys are allowed to have the code.
Disclaimer: I am not a professional legal expert and my limited experience is based in the UK. I have negotiated contracts with some small similarities to your situation but came to an agreement without resorting to legal advice. However what seemed to be "common sense" to myself and my clients may not have any legal basis when applied to your already existing contract or your situation.