Suppose I create a very unflattering portrait of a celebrity and
publish it in a book marketed as a scathing attack on corruption. If
the picture crosses the line, I could be sued for defamation.
But suppose I hire someone else to create such a picture. I could
still be sued, of course. What I'd like to know is if the artist I
hired can also be sued.
As a crude example, suppose I told an artist, "I want you to draw a
caricature of President John Doe having sex with a donkey."
This is a false premise.
There is no valid cause of action (in the United States at least) for either an unflattering portrait of a celebrity or an unflattering photograph of a celebrity (or for that matter a private person, who has more protection under U.S. defamation laws). There is no line you could cross that would be too unflattering. The example that you give would not only be perfectly legal, but is actually rather common.
If you photoshopped a photograph to create a false impression that someone did something damaging to their reputation in a manner calculated to make people believe that it authentically shows someone engaging in, for example, a crime, that might be defamation, but that is different than the conduct described in the OP. But, the gravamen of defamation is defrauding the public, not merely acting in bad taste or rudely.
A celebrity could sue for commercial appropriation of their likeness to sell something, in an amount comparable to what they would charge to be a model, if they are used as a model or endorser to sell something, but this would not generally apply to anything that is critical of the subject.
The facts you suppose are so far off from what constitutes defamatory conduct that it is really impossible to evaluate the work for hire/vicarious liability questions you are trying to ask without a completely different question. I'm not going to try to frame a factual scenario that would get at this issue myself.