Another thing to note is that while India just approached Russia to joint develop an Indian version of the P-800 Oniks, well before this time (early 2000s) Russia already offered China the P-800 Oniks missile which China rejected.
Over a decade before India approached Russia to co-develop the Brahmos, China already purchased and used the Russian Kh-31 which it indigenised in the 1990s into the YJ-91 anti-radiation missile. During this era China also purchased Sovremenny Class destroyers mainly for the P-270 Moskit missile. PLA considered buying Tu-22Ms for Kh-32 missile, thinking of fielding some tiny numbers of Sov class with Moskit and Tu-22 with Kh-32 could discourage USN. This was the backup, conventional plan for the 2010s period of Chinese A2AD strategy.
The parallel strategy (think Su-35 being conventional and J-20 being domestic parallel) for A2AD was based on making DF-21 into a MaRV capable missile that can be guided to target and hit moving, high digital resilience targets. This was far more promising. Chinese warships focusing on AD and limited anti-surface was also more promising than the Sov class + Tu-22M combo. Move 20 years ahead and here we are. A2AD based on high tier (not just MaRV) hypersonics launched from all platforms backed by conventional supersonic anti-ship and stealth anti-ship missiles. Stronger sensor network and integrated AD than Soviet/Russian strategy for warships. Instead of Tu-22M launching Kh-32 we have H-6 (slower by a mile) launching YJ-18 (Kalibr family derived), YJ-12 and YJ-21 (before the new hypersonics revealed recently). Domestic course delivered. The 1980s and 1990s Chinese military leadership could not have realised how much better domestic industries would turn out.
As for the Brahmos and YJ-12 story. Well India started receiving Russian built Brahmos in late 2000s. China designed the YJ-12 as a culmination of experience with the CSS-C-6 aka C-301 or HY-3 missile program, the Soviet Kh-31 missile, and the P-270 Moskit. That's three types of rocket boosted ramjet powered supersonic cruise missiles going back more than two decades before the Brahmos was even on paper. YJ-12 is the culmination of 30 years of playing around and testing various types and lineages of ramjet powered cruise missiles. The Oniks derivative was rejected by China back in the 2000s if not earlier.
When Indians say Brahmos is 900km and mach 3, well Chinese DF-21D is >1500km range and mach 10 against moving target, DF-26 is 5000km range and mach 20 against moving target, DF-17 is >3000km range and >mach 5 at terminal, DF-27 is probably >5000km and >mach 10 as a IRBM based anti-ship HGV. YJ-19 is at least >1000km ranged HCM. YJ-17 is at least >1000km HGV. These are not even all of the top tier missiles. All self produced at whatever rate and numbers required.
Space, air, sea, land, sub-surface platforms, every single one, all communicate, share, guide, target, feed and contribute to the sensor and shooter network. A HALE drones' radar and space based remote sensing platform can spot a stealthy target anywhere weapons can reach, a stealth fighter or CCA can verify, a ship can launch, another drone can guide. Every combination has been there, iterated, improved. India can barely feed Brahmos missile with mid course guidance from other platforms until recently.
I don't see the comparison between Brahmos and YJ-12 without understanding the force and weight behind them.