The British committing navy for East India company is not remotely similar to PRC inaction to curtail organized crime operations in LATAM when they'd rather direct resources domestically or in ASEAN. The primary attack vector of Opium War was military force, i.e. an actual war. The primary victim throne and treasury not civil society via gunboat diplomacy. One is a state actively investing large diplomatic and military resources to target a specific opponent, another is a state doing nothing / not going beyond to assist another state for what happens in their borders.
Besides, the US drug epidemic predates PRC/fentanyl for decades. PRC is fine with reaping benefits of US dysfunction on the sidelines - most of the world and their politicians get propaganda value from mocking dysfunctional US drug policy. America the Great not being able to control drug use within their borders is an quintessential American problem through and through. Again being indifferent schadenfreude =/= supporting. PRC hasn't even unscheduled fentanyl yet, a legal drug previously scheduled at US request. If PRC was actively malicious, they would go back to skipping Mexico/LATAM as middle man and coordinate at state level to swamp the US directly at scale.
IMO the main benefit of poor US drug enforcement for PRC is MSS (PRC intelligence) being able to exploit opportunity to coordinate with LATAM based PRC triads to build out intelligence networks and influence. Their primary business is money laundering, largely for PRC capital flight. It doesn’t matter who actually provides the drugs/precursor (India/Mexican producers are in the game as well), or if it even needs to be drug trade in the first place.
>inflict pain and suffering in China, as a goal in itself
If US wants to reverse fentanyl trade into PRC they can go ahead. PRC state capacity is much better at dealing with domestic drug trafficking - like many other Asian countries. Otherwise the US has been trying to infiltrate PRC civil society to ideologically undermine CCP for decades despite PRC protest. PRC's ultimately decided to crack down domestically - see western NGO closures, eradicating CIA spy network, or HK protests. Something is uniquely dysfunctional with the US approach when PRC can fight ideas/influence better than the US can fight drug trafficking.