Heh, I've been wondering the same question for the last few years, but the truth is nobody really knows how many Y-9 airframes are being built per year. And we definitely do not know how many special mission types are being built per year of per type... for all we know it may vary year to year depending on requirements.
However, I do believe that special mission Y-9 variants are adapted during production directly into their variants -- they are not first "completed" into the full standard transport Y-9 and then converted into their special mission variants, because such a method would obviously be a waste of time and money and needlessly complex.
Of course, converting airframes directly into variants is pretty par the course for these type of planes; production E-3s, KC-135s were mostly converted from airframes directly from the production line rather than rebuilt from already built C-135s or 707s, in the same way that modern aircraft like P-8A or various tankers are converted directly from the airframe production line into their variants (or may even have dedicated production lines for their variant) instead of being converted only after the airframe has been built into a "completed" Boeing 737 or 767 or A330 or what not...
Some air forces or companies do convert "completed" airframes into special mission aircraft -- IAI offers the conversion of existing Boeing 767s to tankers, and the China Air Force has also obviously converted existing "completed" aircraft like Il-76s and Tu-154Ms for their KJ-2000s and Type II SAR aircraft, respectively -- but generally speaking if a country has the domestic industry to produce the airframes themselves, then they will produce special mission aircraft directly from the airframe production line instead of waiting for the aircraft to be completed... unless there are unique circumstances such as if it's a one-off test/prototype special mission aircraft, or if the aircraft they want to convert is out of production, or even sometimes due to cost.