It's easier to give an elementary formula for this sum directly than in terms of the sum you give, though one can give a formula in terms of this sum by taking a ratio of Euler factors.
Let $q$ be a prime different from $P$. Then we can write $\lambda_f(q) = \alpha_f + \beta_f $ where $\alpha_f \beta_f =1$ and similarly for $g$ and $h$. Then the Euler factor of $L(s, f \times g \times h)$ is $$\frac{1}{ (1 - \alpha_f \alpha_g \alpha_h q^{-s} ) (1- \alpha_f \alpha_g \beta_h q^{-s}) (1-\alpha_f \beta_g \alpha_h q^{-s}) (1- \alpha_f \beta_g \beta_h q^{-s}) (1 - \beta_f \alpha_g \alpha_h q^{-s} ) (1- \beta_f \alpha_g \beta_h q^{-s}) (1-\beta_f \beta_g \alpha_h q^{-s}) (1- \beta_f \beta_g \beta_h q^{-s})}.$$
Similarly, at the prime $P$, we can still write $\lambda_g = \alpha_g +\beta_g$ with $\alpha_g \beta_g=1$, and similarly for $h$, but now $\lambda_f = a_f= \pm 1/\sqrt{q}$. Then the local factor is simply
$$\frac{1}{ (1 - a_f \alpha_g \alpha_h P^{-s} ) (1- a_f \alpha_g \beta_h P^{-s}) (1-a_f \beta_g \alpha_h P^{-s}) (1- a_f \beta_g \beta_h P^{-s})}.$$
Taking the product of these prime factors over all primes gives you the $L$-function.
The way I know how to prove this is by taking the local Langlands correspondence and using the definition of the local $L$-factor in terms of Galois representations, but surely there is a purely automorphic proof as well.
If you want to divide this by the naive Dirichlet series, you'll get at each prime $q$ other than $P$ an Euler factor that is the inverse of some explicit polynomial of degree $6$ in $q^{-s}$, and at the prime $P$ an Euler factor $\frac{1}{ 1- a_f^2 P^{-2s}}$. You can get these formulas by factorizing the naive Dirichlet series into a product of sums over powers of primes $q$, then multiplying those sums by the denominators appearing here and cancelling terms until you obtain a polynomial.
Edit: The "correction" Euler factor at primes away from $P$ is given by the inverse of
$$ (1 - \alpha_f \alpha_g \alpha_h q^{-s} ) (1- \alpha_f \alpha_g \beta_h q^{-s}) (1-\alpha_f \beta_g \alpha_h q^{-s}) (1- \alpha_f \beta_g \beta_h q^{-s}) (1 - \beta_f \alpha_g \alpha_h q^{-s} ) (1- \beta_f \alpha_g \beta_h q^{-s}) (1-\beta_f \beta_g \alpha_h q^{-s}) (1- \beta_f \beta_g \beta_h q^{-s}) \sum_{n=0}^{\infty} \sum_{i,j,k=0}^n \alpha_f^i \beta_f^{n-i} \alpha_g^{j} \beta_g^{n-j} \alpha_h^k \beta_h^{n-k} q^{-ns} $$
The only way I know how to evaluate this is just to multiply it out. It's possible to check that the coefficient of every term with degree in $q^{-s}$ at least $7$ will cancel, so you really get a finite formula by multiplying it out, albeit a complicated one.
The coefficient of $q^{-0s}$ is $1$ since all the terms are $1$ there.
The coefficient of $q^{-s}$ is $0$ since each product of $\alpha$s and $\beta$s is canceled by a corresponding product on the other side.
The coefficient of $q^{-2s}$ is $$-\alpha_f \beta_f \alpha_g \beta_g (\alpha_h^2 + \beta_h^2)- \alpha_f \beta_f (\alpha_g^2 + \beta_g^2) \alpha_h \beta_h - (\alpha_f^2 + \beta_f^2 ) \alpha_g \beta_g\alpha_h \beta_h - 3 \alpha_f \beta_f \alpha_g \beta_g\beta_g\alpha_h \beta_h = - \lambda_f^2 - \lambda_g^2 - \lambda_h^2 +3$$ since all the terms $$\alpha_f^i \beta_f^{2-i} \alpha_g^{j} \beta_g^{2-j} \alpha_h^k \beta_h^{2-k}$$ where none of $i,j,k$ equal $1$ give $1-1$ and cancel, all the terms where exactly one of the $i,j$ equals $1$ give $1 -2 + 1$ and cancel, all the terms where exactly two of the $i,j$ equal $1$ give $1 - 4 + 2 = -1$, and all the terms where all three of the $i,j,k$ are $1$ give $1 - 8 + 4 =-3$.
For the coefficient of $q^{-3s}$, all the terms $$\alpha_f^i \beta_f^{3-i} \alpha_g^{j} \beta_g^{3-j} \alpha_h^k \beta_h^{3-k}$$
where one of the $i,j,k$ equals $0$ or $3$ cancel, and the remaining terms all contribute $1 - 8 + 13 -4 =2$, so this coefficient is
$$ 2\alpha_f \beta_f (\alpha_f + \beta_f) \alpha_g \beta_g (\alpha_g+\beta_g) \alpha_h \beta_h (\alpha_h + \beta_h) = 2 \lambda_f \lambda_g \lambda_h.$$
Computing the next three coefficients may be beyond my stamina.