Let $p,q$ are two formulae in a first-order language $L$ and $x$ is a variable which is free in $p$ while it is bound in $q$.
Why we accept the fact that $(p \Rightarrow q)$ is a formula but refused to discuss some deeper properties of it (e.g. if $x$ is free in this formula) rather than add a restriction of the definition of formulae to avoid the occurrence of such formulae (i.e. Let $p,q$ be formulae. $(p \Rightarrow q)$ is a formula if and only if there is no free variables in $p$ is bound in $q$ and also no bound variables in $p$ is free in $q$.)? Since we would not write proposition in the form mentioned in the above, I don't think that it will bring any confusion or inconvenience if we just simply do not see them as formulae.
There is no actual issue with $P(x)\to\forall x.Q(x)$. That is, the meaning is completely unambiguous. Sometimes people may get confused, but that's just because humans are bad at following directions (and authors rarely bother to fully specify the directions).
So the first reason that we don't do this is that it is not solving any actual technical problem. The problem you seem concerned about is a problem of presentation and doesn't need to be solved by the definition of well-formed formulas. If such formulas are confusing, then simply don't write such formulas. You can just have that be a convention. In the lambda calculus, this is called Barendregt's Variable Convention.
A second reason is that it significantly complicates the definition of well-formed formulas, and from there any operations or proofs about them. This is already evident from your description, but consider an operation like substitution. It is now either a partial operation, or we need to have it rename bound variables in a globally aware manner. This will significantly complicated its definition.
A third reason is that this is the opposite of what we want to do conceptually. This definition makes the names of bound variables matter quite a lot, but we want them to not matter at all. Often we define a notion of $\alpha$-equivalence that states that two formulas are $\alpha$-equivalent if they can be made equal just via a renaming of bound variables. We then tend to treat $\alpha$-equivalent formulas as literally equal. In fact, there's a whole area of logic/CS called nominal techniques where things like nominal logic are defined in which we can axiomatize the notion of well-formed formula such that it is actually the case that $\alpha$-equivalent formulas are equal.
This non-importance of variable names reflects the fact that they are just a means to textually represent something that doesn't fit well into a textual representation. You could imagine other presentations where instead of having bound variables, quantifiers just have a bunch of arrows going from the quantifier to the occurrences.1 This more graph-like structure is arguably a "truer" representation of the mathematical object that is a well-formed formula.
1 Or you could fit it into a textual representation via de Bruijn indices.