It's an interesting question, but this is too big and complex a topic for us to address in a short answer in this forum. You should obviously take legal advice if it concerns you. There is a notion of "prior art" which is relevant here, and also the ability of open source products to provide protection against patents by their very nature, depending on the license used.