Yes, both compnies can file the H-1b extension or transfer for you at the same time. But if you want to change your job to Company B, you had better ask Company not to file the extesion petition for you, vice versa. You know the company needs to spend their money for the filing and if you do not want to work for the company, it is not good to ask the company to waster their money and time.