You are mistakenly interpreting the German Law. What it does prohibit is when a work is in public domain (such as a sculpture or painting) but you take a picture of it, you may not use the picture, since (very stupidly, but nonetheless) the court determined, that if you take a picture of a public domain work, the supposed creative process of taking the picture is enough to give all ownership of the photo to the photographer. It also states, that when an art piece is in the museum, by it's mere display there, the photographs taken of them are no longer in public domain.
HOWEVER, there is nothing about software in the link you provided. Even if you tried to apply the German Court Interpretation to Software (it should be noted, that likely, in software, a new interpretation should be required), then still public domain code COULD be used in commercial works - however, if you added one line of code to the public domain code, nobody would be able to use the modified (even slightly) code. Again, this is speculation, since I don't know of any such Court decisions. Regardless, you can use public domain work in commercial projects. Beside, software is usually regulated by some international copyright deals, which could possibly ensure that public domain can of course be incorporated.
*DISCLAIMER: I am not a lawyer, much less a German lawyer, and this does not constitute professional legal advice. If in doubt, please refer to licensed law professionals.