It is unorthodox but not, perhaps, inconsistent with Utilitarianism!
Firstly, it might be worth reflecting on Mill's style of philosophy. He was a practical philosopher who often altered his style, the way of delivering his message and contents depending on his audience and his intentions. For that reason, there are sometimes rhetorical motivations behind what he says.
I think it is harder to pin him down on exactly what he means than some other utilitarian philosophers. Henry Sidgwick, for instance, is drier but in his philosophy it is easier to follow a precise chain of argument to reach conclusions. Bentham's conclusions are much plainer too, and easier to translate into a 'rule for action' than Mill's. But that is due, at least in part, to the complexities that Mill grapples with, some of which get left out of the ethical prescriptions of Bentham and Sigdwick.
We could see in Mill's philosophy a precursor to some of the objections levelled against Utilitarianism by Bernard Williams. Like Williams, Mill drew on the work of poets and playwrites to undermine some of the simplifying assumptions of Betham's 'Act Utilitarianism', and the way it responds to the inherently complex nature of the world. Both William's and Mill's critiques of (in Mill's case Benthamite) Utilitarianism involve some concern about the way the doctrine systematises our responses to the world. There is something too mechanical about it.
Mill's political agenda diverges radically from Bentham's. The latter tends on focus on technical means of producing greater welfare for the greatest number whereas Mill's overriding concern is with individual autonomy. For Mill, the good life depends on each of us being able to decide for ourselves on the kind of life we want to live.
It is easy to see how there may be a certain amount of pain in such a life. Breaking free of the values that are given to us by our social environment may be painful. Pursuing our own adopted values against the grain of social norms may also be painful.
So why count Mill a Utilitarian at all? In much of his writing, he seems to be concerned with autonomy rather than happiness. Well, Mill shares with other Utilitarians the (axiological) belief that what matters are pleasures and pains. It's just that, for him, the most important pleasures are to be arrived at through this process of self-creation.
You suggest that pain might be required in order to fully appreciate pleasures. That's plausible. Or it could just be that Mill is describing the fact that (the world being constituted as it is), pains will inevitably arise at some point if you are trying to live a good (autonomous) life.
The alternative is that some pains are intrinsically valuable. It could be that pains, as we commonly see them, aren't really pains at all if they are sufficiently few, and balanced out by pleasures. They serve to enrich our subjectively felt life and, in the broadest sense, make us happier.
In the first two of these cases, pain plays an instrumental role. We can imagine a world in which we don't need to go through pains to enjoy the same pleasures (such a world is not logically inconceivable).
Would Mill prefer such a world to the world we actually live in?
If, by clicking his fingers he could ensure that the greatest pleasures were just as pleasurable without the need for pain, would he refuse to click? It is hard to see why he would. Unless it is with recourse to something like the third possibility I outlined, that he sees some pains as intrinsically valuable.