There are several problems with your question. The idea of the experience machine doesn't make sense. If you are being given some sensation the only thing that makes the sensation pleasant is your interpretation of it. And your interpretations will change as you create knowledge. So the machine would have to be able to predict the growth of knowledge to anticipate what you're going to want. But that's impossible. If you could know today what knowledge you will have tomorrow you would already have it. As the machine creates new knowledge about how to pleasure people people will respond to that by learning about how the machine has adjusted itself. Since the machine can't predict its own future knowledge, it can't predict the knowledge that people will develop in response and it can't give them pleasure. So the experience machine can't work.
Is it wrong to force somebody to do something against his will that you imagine he would find pleasant or useful or whatever? Yes, for several reasons.
(1) The refutation of the idea of the pleasure machine applies just as much to you as to some imaginary machine. You can't predict what somebody else will enjoy.
(2) Whatever theory you have about what somebody will find pleasant the use of force makes testing it impossible. The only real test of whether somebody finds an activity worth doing is whether he does it when he is not forced to do it. If he is forced to do it he will do it regardless of whether he finds it worthwhile. So you are not only trying to do something impossible you are trying to do it while destroying your capacity to detect errors in what you're doing.
(3) The idea that ignoring a person's objections to something you want him to do is making him experience reality is wrong. Since you have no interest in whether he understands and consents to what you are doing to him, you have no interest in whether he can interpret the experience properly and learn from it. So there is no fundamental difference between the case in which you force somebody to do something that you think should give pleasure and something that you think is "real". (I put inverted commas around the real because the experience in question is made up and controlled by you: it is a story you made up, not reality.)
(4) Your fantasy about a brain disease that somehow reprograms a person to want to hurt himself is grossly immoral and dehumanising. A fault in the brain caused by some chemical or bacterium or structural fault is not going to make a person refuse some particular kind of experience. Such faults don't instantiate knowledge about what people want, any more than a fault in your television would make it display television shows you dislike. See the writings of Thomas Szasz, such as this essay.
You ask:
Does my own opinion matter (meaning, let's say I'm in the same
position as the man in the first case myself, but I wouldn't refuse
the opportunity to plug in to the experience machine)?
If you want to do something that will produce a particular sensation that you interpret as pleasure go ahead. This activity is about as worthwhile as sitting around pushing a red button all day just because it's red. You will thereby place an upper limit on the value you can get out of your life in terms of aesthetic progress, moral progress, scientific progress or any other kind of progress. You're just doing something you already know how to do. Inflicting such treatment on yourself is stupid, inflicting it on somebody else is evil.