Is it possible for a legitimate manufacturer to produce a substandard medicine deliberately?

Why not?

Any one who has intention to make money unlawfully can produce a substandard medicine deliberately. There is nothing to prevent him/her from producing as so long as he/she can avoid detection and prosecution. It is more likely to happen in countries where medicine regulation is ineffective and/or law enforcement is weak.