But "defend it or lose it" means going after all infringers, which patent trolls certainly don't do. They are currently very selective about enforcing their patents, choosing to assert where they will win.
This is why, in principle, there is the "prior art" clause. It's just not enforced well enough in the software realm--but the mechanism to prevent patenting something widely known a posteriori does technically exist.