While you're right that there are some practical issues with this sort of system, one should also recognize that the patent system doesn't current scale well either. You have to check the claims against every publication in existence. Since this isn't possible, this ultimately has to be fought out in court -- yet a granted patent still carries with it a presumption that the patent rights should be upheld.
One could, however, have a system where if two separate teams file patents before either are published, they should not have to license it.
One could, however, have a system where if two separate teams file patents before either are published, they should not have to license it.