It's happened to me before where recruiters represent me for an unknown job that turns out to be one I am already interviewing for. Then the recruiter, not the company, sends me the "more qualified candidate rejection" (usually by a clueless idiot). Are they invoking some contract with the Company claiming they represented me first so I can't be hired by them directly?
Unless you have signed any paperwork with the recruiter (which you should NEVER do), that's not the recruiter's decision but it's governed by the contract between the company and the recruiter. You are not privy to this contract, so can't know for sure.
Tell the company about it and let them duke it out. If they were stupid enough to sign a contract that doesn't cover that scenario properly, it's their fault. You may become collateral damage in the process, but that's unlikely and there is nothing you can do about this.
Many end clients require that the recruiter has you send a "right to represent" form, either on paper or by email, for the exact reasons you're stating.
Outside of that -- when you deal with a recruiter and you're actively searching at the same time, you MUST compel the recruiter to supply you with the name of the company before they submit you. There will always be a few scumbags out there who don't want to follow any kind of protocol, and there's not much you can do about it. But the reason to get this information before a submission is to prevent a possible double-submission. A double submission scenario might prompt the end client to reject you outright because it's hard to track whether your submission came first, or the recruiter's, and since the recruiter's 10% commission is on the line this can end up causing a lot of mess that a hiring manager will quickly want to back away from.