What you are describing is a difficult situation, because a couple of written or unwritten rules are in conflict:
- Those who made intellectual contributions to a piece of research should get the contribution.
- Students or postdoc that are leaving a group should not (and should not be able to) block the scientific work of the rest of the research group.
- If you made a building block to be used in scientific work, you get credit for it by being cited - your software being used in some work does not give you the right to demand authorship of the paper.
- Writing software is not automatically an intellectual contribution.
Additionally, it looks like the whole issue was not handled very well.
From your question it looks like you never wrote a proper scientific paper on your software. If you had, your scientific paper could just be cited in all papers using your software, and you would not be an author of the papers in which your software is used. Then all rules above would have been satisfied.
Because you never wrote a paper on your software, there is now a conflict. You can't expect to be in the author list of every paper using your software just because it was not public, because that would mean that by not publishing your paper on the software, you get authorship on many papers essentially for free. At the same time, you can't expect your former group to not use your software, because then you would be blocking their work. Most likely you also got funding from the PI (if not, on the legal level, this may be different).
At the same time, it's certainly bad style that your contribution was forgotten in some cases - you should have been mentioned in the acknowledgements. After a few years of not publishing the paper about your software, you shouldn't be surprised to be forgotten, however.
A different issue is that X is still using your software after leaving the PI's group. If you got funding from the PI, then there may be the expectation that your PI has unlimited usage rights of the software, including sub-licensing it to X - which may have implicitly or explicitly happened, especially if X continued to work on it.
Now what are the possible solutions apart from "forget it"?
- Ask X if she/he wants to co-author a paper on the software with you. If you don't have enough time to write it completely on your own now, perhaps that is an option?
- Publish a short paper on your software, so that you can still find enough time to write it. It doesn't need to explain everything, but enough to be citable. Do so with the knowledge of the PI and X, so that in future papers, they can cite you correctly.
(I'm happy to update my answer if I forgot possibilities).
Note that rules 3 and 4 above may come in minor variations in some fields of research. In computer science, for instance, it is quite common to propose new algorithms that crucially depend on some other existing work — still, the authors of the existing work do not get authorship for the new work. Only if the existing work (which could come implemented in the form of a tool or library) needs to be modified in intellectually non-trivial ways, the authors of the existing work are typically invited to also be authors for the new work. Rule number 4 is addressed by some academic conferences having "tool papers" to allow researchers taking the time to write complex scientific software getting some publication credit for it.