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 [73], [152], [49], [16]." 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'.
Added: I will admit to being surprised by the downvote: I don't see that I've said anything remotely controversial. In particular, I don't disagree at all with @ff524's answer (which I upvoted): I said only that vigilance in pruning citations could be taken too far. This is not the first time that I've encountered on this site the phenomenon of cultural differences in citation practices between my field (mathematics) and certain other academic fields. As I've said before and again in this answer: mathematicians are rampant underciters, to the point in which people end up spending significant amounts of time and effort replicating others' work. That's a problem which in my mind safely outweighs the damage one does to the readability of one's own paper by too much buckshot citation or the games that apparently some people play to try to increase their citation index. Does anyone disagree with this? I would be interested to know.
One thing that I could have been more explicit about in my answer: in general, there is a spectrum of relevance in citations, with "so obviously irrelevant that you are perpetuating some kind of academic dishonesty by including it" on one end and "so obviously crucial that you are perpetuating another kind of academic dishonesty by omitting it" at the other end. Clearcut cases should be clearly addressed, absolutely. There are also less clearcut cases, and in such cases I would recommend giving some latitude to the authors (especially if the "crime" is reducing the signal-to-noise ratio of their paper: a helpful referee might point that out, but ultimately that's the authors' own feet to shoot if they choose).
I did mention citations in a recent referee report. I wrote:
[Self effacing remark along the lines of "I could be wrong, but..."], Result X of the paper doesn't look so similar to Result Y of a paper they cite [and which was only cited by way of comparison and not used in any way]. I don't find this citation irrelevant per se, but it makes me wonder why they didn't cite Z1,Z2,Z3 which seem MORE relevant.
The authors specifically responded to this point in their revision. They said, essentially:
The citation to Y was not in our first draft. We added it based on feedback. We agree that Z1,Z2,Z3 are also relevant, and we added them.
I was quite satisfied with that. Final citation density of the paper after adding the citations I suggested: about .5 distinct citations per page.
I also find this comment of ff524 interesting:
Consider yourself lucky that you rarely have to review papers that indiscriminately cite all the authors' previous work, an assortment of unrelated papers from the journal it's submitted to, and the first ten papers that appear in Google scholar for a related keyword. (I exaggerate only slightly)
It's not just rare; I have never refereed or even seen a mathematics paper that has anything like that level of citation. I have refereed at least 30 papers, so if I'm "lucky", it may be that I'm lucky to be a mathematician rather than an academic in some other field. While I certainly do feel lucky to be a mathematician, in this case once I again I suspect that this lack of a problem is a symptom of the opposite, more serious problem.
Is this phenomenon really common in other academic disciplines? I find that surprising: to me it sounds like the sort of "rookie mistake" that some young person might try once and their advisor would correct.