Firstly, one needs to appreciate that there is no unique solution to the problem at hand, so one cannot ask Mathematica to find the expected answer. At best, it can find the relation between the dependent variables ($a,b,c$ in the simplified example) in terms of independent variables ($r,t,\theta,m$). Fortunately, this is quite doable.
The main function that we will be using is Reduce
, which will give all possible cases for which given function is zero. We will then eliminate the possibilities which require independent variables to take specific values (such as $r=0$), as these cases are isolated solutions whereas we are interested in generalized solution. Finally, we will assume that the required inequalities for the solution is satisfied (such as $r\ne0$, which is actually a condition for OP's preferred answer as it involves $a=m^2/r^2$).
The code to do these is as follows:
ClearAll[solve];
Options[solve] = Options[FullSimplify];
solve[independentParameters_List, opts : OptionsPattern[]] :=
Module[{condition, replace},
condition[a_, b_] := Table[FreeQ[Equal[a, b], i], {i,
Subsets[Alternatives @@ independentParameters, {Length[independentParameters] - 1}]}];
replace = Equal[a_, b_] :> False /; (Or @@ condition[a, b]);
FullSimplify[Reduce[# == 0] /. replace /. Unequal[a_, b_] -> True,
Assumptions -> opts]
] &;
We can see it in action as follows:
p[a_, b_, c_][t_, x_, y_, z_] := Exp[t] (a x^2 + b y^2 + c z^2);
p[a, b, c][t, r Sin[\[Theta]], r Cos[\[Theta]], m] // solve[{r, \[Theta], m, t}]
(* a + b Cot[\[Theta]]^2 + (c m^2 Csc[\[Theta]]^2)/r^2 == 0 *)
which gives the general solution:
$$a+b \cot ^2(\theta )+\frac{c m^2 \csc ^2(\theta )}{r^2}=0$$
We can now fix any solution we like; for example, we can get OP's result back as follows:
a + b Cot[\[Theta]]^2 + (c m^2 Csc[\[Theta]]^2)/r^2 == 0 /. {c -> -1, b -> m^2/r^2} // FullSimplify
(* a == m^2/r^2 *)
The code as written is quite general and should work with other input. In particular, we did not make use of anything specific to the function $p(t,x,y,z)$. As an example, consider a similar yet modified function:
p2[a_, b_, c_][t_, x_, y_, z_] := Exp[2 t] (a x^4 + b y^4 + c z^4);
p2[a, b, c][t, r Sin[\[Theta]], r Cos[\[Theta]], m] // solve[{r, \[Theta], m, t}]
(* a + b Cot[\[Theta]]^4 + (c m^4 Csc[\[Theta]]^4)/r^4 == 0 *)
for which fixing
$$c=-1\;,b=\frac{m^4}{r^4}$$
gives us the answer
$$a=\frac{m^4 \left(\cot ^4(\theta )+\csc ^4(\theta )\right)}{r^4}$$
We can of course use the code for functions with other number of variables. For example:
p3[a_, b_, c_, d_][t_, x_, y_, z_, u_] := Exp[t] (a x^2 + b y^2 + c z^2 + d u^2);
p3[a, b, c, d][t, r Sin[\[Theta]], r Cos[\[Theta]] Sin[\[Phi]], r Cos[\[Theta]] Cos[\[Phi]], m] // solve[{r, \[Theta], \[Phi], m, t}]
(* a + (d m^2 Csc[\[Theta]]^2)/r^2 + Cot[\[Theta]]^2 (c Cos[\[Phi]]^2 + b Sin[\[Phi]]^2) == 0 *)
for which fixing
$$b=c=\frac{m^2}{r^2}\;, d=-1$$
fixes
$$a=\frac{m^2}{r^2}$$