If the AI doesn't somehow get the unit for free, getting AI cities to train it seems tricky. The unit flavor value is, apparently, only used for Great People (getDiscoveryTech in CvGameUtils.cpp) and solely to determine which techs they can discover; CvCityAI ignores it (no call to the respective getFlavorValue function). Worse, cities only consider producing units of specific unit AI types, well, of most of them, but the GP AI types aren't among those (AI_chooseProduction, AI_chooseUnit, AI_bestUnitAI in CvCityAI.cpp). Moreover, the AI code really figures out on its own what unit AI types a unit is suitable for. The AI types in XML force the AI to take a particular type into consideration, but, if the unit doesn't have the proper stats and abilities, the AI will probably prefer more suitable alternatives (CvPlayerAI::AI_unitValue). And, even if you make your unit e.g. also a decent scout, – if the AI chooses to produce it for that purpose, it'll also receive UNITAI_EXPLORE upon completion and will behave only according to that role.
Maybe modders who are used to working with just XML have figured out some (least bad) workaround for these issues. But Nexus's answer in the Quick Modding thread is not encouraging, seeing also that he mods based on Rise of Mankind - so it seems that AI mods have not added AI support for producing unusual units either. Through DLL changes, code for training UNITAI_SCIENTIST could of course be added and, through Python, it's also possible to just tell an AI city under specific, perhaps somewhat clumsy conditions to switch its production to any particular production order – or to change the unit AI type of a unit on the map (assuming that it has some sort of dual role that will make the AI interested in producing it). As for overriding the city production, there was a recent thread about that ...
here. Quoting those posts should restore the indentation of the Python code. Perhaps prudent to test if UNITAI_SCIENTIST really results in the desired behavior (WorldBuilder can assign unit AI types) before putting effort into Python scripting.