Short Answer
A combination of the Eclipse Public License and the LGPL ensures exactly what you wish: Modifications of your code have to be made available, but using the code in a larger product does not force the larger product being relicensed. The combination is necessary to allow the code to be used in both GPL and non-GPL projects.
This is a way projects such as JGraphT have done.
They relicensed their project under EPL and LGPL.
The motivation and procedure is described in their wiki.
Long Answer
I think, the Mozilla Public License (MPL) or the Eclipse Public License (EPL) is the license you are looking for, because "if any derivative work from the library is created (any improvement of the library for example), it [IS] made available to everyone under that same license."
The MPL and the EPL license is between of GPL and MIT.
MIT allows the user to do everything with it, including modification, selling and not giving back the modified code to the community.
GPL forces the user to give away all the code to the community, even if your library is only 1% of the whole product.
LGPL forces the user to give away the modification of the LGPL-part of the code.
MPL and EPL are similar to LGPL: It also forces the user to make the modified source available. "Modified source" includes only the part of the MPL-/EPL-covered code. That means, the user may build a new product out of your library. If he does modification of the MPL-/EPL-part, he has to publish it. The new things by him do not need to be published.
I feel the MPL/EPL more fitting, as LGPL explicitly talks about "libraries" and MPL just talks about "Covered Software" (which is a broader scope).
However, choosing EPL causes trouble with combing the software with GPL software: The EPL is not compatible with GPL. This is not the case if you just use the MPL.
If you want to ensure that your code may be used in both GPL and non-GPL projects, dual license the code under LGPL and EPL as described in the short answer.
Examples
- JGraphT
- logback
qooxdoo. They are planning "to simplify and modernize the qooxdoo licensing terms" and thus they switch from the dual licensing to MIT.