I DID charge my client to implement the library within their project. This implementation belongs to them immediately.
Now I, of course like many engineers, use similar ideas across clients. However, these are rewrites in one form or another. Frankly I have never read a line of code (my own included) that I did not hate and think I could do better. So I don't have any issue with rewriting code for a client that does something similar to another client I had previously. They own that code and I charge them (quite a bit) for it.
Negotiation can take a very long time and that time is unpaid. I would prefer to have a good solid pipeline of clients who use a standard contract and a shorter time from negotiation to signing then having to renegotiation every contract that I come into contact with. And yes my contract protects my clients quite well. Which is why I have a lot of repeat business and get paid regularly, without fights, and on time.