A rule that was told to me in my youth and I have always obeyed and agreed with: never include a paper in your bibliography unless you cite it in the text itself. Like most rules, it admits some exceptions: for instance if a primary purpose of your paper is to gather references -- e.g. if you are writing a retrospective on the work of one specific person, or you are the first to compile what you intend to be an all-inclusive guide to the literature of an entire sub(sub...)field -- then this would not apply.
Of course one should in most cases try to go farther than the above rule: as a reader I am not thrilled when multiple references get dropped in a single phrase, e.g. "For more work on this problem see , , , ." In an age of increasingly sophisticated electronic bibliographic catalogues, this sort of "buckshot citation" seems to have little value. Just a couple of days ago I read a famous paper (why not? it was Alon-Friedland-Kalai, Regular subgraphs of almost regular graphs, 1984) and noticed that they were not phrasing their results as explicitly in terms of a certain concept as it seemed to me that they should: that would simplify the proofs and result in some mild strengthenings. Well, it's no big deal but I got curious as to whether anyone had later made this connection more explicit. An appropriate google led me to a survey paper in which the AFK paper was mentioned...but in the above buckshot approach: nothing is specifically said about the paper in the text, not even the names of any of the authors. As a result I am left to wonder whether the connection has actually been made. Which is no big deal -- I have corresponded with an author of the (nice) survey paper before, and this is a good opportunity to do so again -- but the point stands: citing that paper and not doing any more than that doesn't seem to accomplish much.
On the other hand, I think the kind of vigilance in calling out weak citations that @ff524 lauds could be taken too far. In some fields -- like mathematics -- we are pretty rampant under-citers, to the extent that it makes it harder for a non-veteran to find their way through the literature, which can result in duplication of work. Citing too little is a crime which has real victims. Citing too much is a crime only* because of the current academic fad that one's research profile can be accurately estimated in terms of citations indices. I would encourage every academic to maintain a healthy skepticism about that: again and again I have found important, deep papers with few or no citations, and I have often found that what is most cited is what is easiest to understand.
If you really believe in the science of citation indices, I think you need to at least approach it with some sophistication. The issue that the OP specifically asks about can be dealt with by keeping track of self-citations, which is certainly trivial to do with current technology. Creating and implementing algorithms that detect and counteract various kinds of "inappropriate citations" sounds like a fun research problem: for instance, we should probably be searching for small cliques in the citation digraph.
*I just remembered that in Gian-Carlo Rota's in/famous Indiscrete Thoughts, he mentions and endorses the practice of sprinkling in some absolutely irrelevant citations to your work as an easy way of making friends. This is definitely a book for which always taking the author literally at his word would be a mistake, but I read his attitude here as one of whimsical mischief rather than real academic skullduggery. The times they are a-changin'.