This can't be right. If I modify open source code as part of the work done, by nature of the open source license that code can not become intellectual property of the client.
Certainly it can. That which is "developed or produced" would be the modifications to the pre-existing code, i.e the copyright on the derivative work so created. If the base code was under a share-alike or copy-left license, then the client can only distribute it under the same license (or a compatible one, perhaps). But nothing compels the client to distribute it, and for the client's use, the client owns the copyright, without fear of any future claims by the contractor.
If I have my own code/scripts/settings/templates/etc that I use as a contractor, and I modify those in the interest of coding efficiency in the interest of serving the client, it hardly seems correct that these assets become property of the Client.
Those are your work, and you can choose whether to sell the copyrights to the client or not. Again, only the work done for that client would be covered under the wording quoted above, unless there is another provision that grants the client a license to use the pre-existing work which you modified for the job, which there probably ought to be. Or I suppose the agreement could assign copyrights in pre-existing work to the client, but that seems an odd choice, and the language in the question would not do that.
You and the client could agree on a different provision such as:
The contractor grants to the client a fully-paid, non-exclusive permanent license to use all intellectual property developed under this agreement, and any pre-existing works that may be incorporated therein. The contractor warrants that s/he is entitled to grant such license, without infringing on the intellectual property of any other person or entity.
That wording would have the contractor retain all copyrights and other IP, but provide a license to the client to use it without further payment or expiration. Many other ways to structure such a provision are possible, dividing the rights up however the contractor and client can agree. The price for the work might vary depending on what rights the client obtains.
Both forms, and many others, are perfectly legal, it is just a question of what the contractor chooses to sell, and what th4e client chooses to buy.