Why is this arbitrary-looking identity of arithmetic functions "obvious"?

This identity a generalisation of the fact that

$$ f(m)f(n) = f(mn) $$

whenever $(m,n)=1$, which holds for any multiplicative function $f$. On seeing this, it's a natural question what happens when $m$ and $n$ are not coprime.

So we're asking for what $f(m)f(n)$ is for a multiplicative function for general $n$. We expect that $f(mn)$ is a 'main term' - indeed, if $f$ is completely multiplicative, then this is exactly what it is. And we know that it is also what it is when $(m,n)=1$. So we expect something like

$$ f(m)f(n) = f(mn) + E$

where $E$ is some correction term that should depend only on $(m,n)$ and $mn$, and should vanish if $(m,n)=1$ or if $f$ is completely multiplicative.

The exercise gives an explicit form for $E$. As you say, there is some amount of calculation involved, but a small amount of trial and error would naturally lead to the correct form. One might begin, for example, by saying that we should measure how far the multiplicative $f$ is from being completely multiplicative. Completely multiplicative means $f(p^{n+1})=f(p)f(p^n)$, so one might define the function $F(p^{n})=f(p^{n+1})-f(p)f(p^n)$.

If you try and put that into $f(m)f(n)-f(mn)-E$ then it becomes apparent that it would be very convenient for an inductive argument if $F(p^n)$ could be 'factored' as $g(p)f(p^{n-1})$. Thus the hypothesis in the exercise.