Aversive stimuli can drive drug seeking.
Central to your question is the dopamine circuit of the limbic system (Fig. 1), being crucial to the reward circuitry in the brain. One notorious way of powerfully activating the reward system is through intake of highly addictive dopaminergic drugs like cocaine, heroin and amphetamines, but also alcohol, albeit less potently. They are so addictive because they evoke strong euphoric, hedonic feelings and the notorious 'crash' when their effects wear off. The euphoric state is a powerful positive reinforcer, the crash a potent negative reinforcer.
Stressors negatively impact emotional state and can drive drug seeking by modulating the activity of the mesolimbic dopamine system. In rats this was tested by stressing them with the administration of the bitter compound quinine. Rats stressed in this way had a decreased dopamine tone in their limbic system. This was accompanied by an increased tendency to seek and use cocaine. This increased cocaine-seeking behavior resulted in increased dopamine levels in the limbic system, at least partially counteracting the stressful quinine shots (Twining et al., 2016).
Admittedly these findings do not directly answer your question
[When] performing unpleasant tasks [can drugs] confuse the brain into
associating those tasks with positive feelings [?]
My answer shows that
Unpleasant tasks can lower dopamine in the brain and drive drug seeking behavior [and cause addiction] when drug intake is associated with [more] positive feelings
Fig. 1. Dopamine pathways in the reward center of the brain. source:
- Twining et al., Addiction (2007); 102(12): 1863–70