@Artemi Seems like the Sun wanted a homunculus and to make homunculi (before cloning Raven) you need a human to modify first. I don't think the Sun planned itself for the Detective to be him, but the Alchemist knew he'd get his victory if Kim became the homunculus. The homunculi however have their free will so they need to be brainwashed, however the Alchemis just set up so he'd become a homuculus but keep his free will.