The problem is that :
$\varphi \rightarrow \forall x(\varphi)$
is not valid in first-order logic.
Basically, steps 2-3 in the (fallacious) proof of the question amounts to this; assume $\varphi$ [i.e. $Rx$] and infer $\forall x(\varphi)$ [i.e. $\forall x (Rx)$].
In order to show that the formula $\varphi \rightarrow \forall x \varphi$ is not in general correct, consider the following example :
$\varphi$ is $x > 0$
and take as the domain of the interpretation the set $\mathbb N$ of natural numbers.
Thus, the formula :
$\varphi \rightarrow \forall x(\varphi)$
means :
$x > 0 \rightarrow \forall x(x > 0)$
which is not true in $\mathbb N$.
We have to recall the basic semantic definitions; see Herbert Enderton, A Mathematical Introduction to Logic (2nd - 2001), page 83 :
we will define what it means for [a structure] $\mathfrak A$ to satisfy $\varphi$ with $s$ [where the assignement function $s : Var \to |\mathfrak A|$ is a function from the set $Var$ of all variables into the universe $|\mathfrak A|$ of $\mathfrak A$] :
$$\mathfrak A \vDash \varphi [s]$$
$\mathfrak A \vDash \varphi [s]$ if and only if the translation of $\varphi$ determined by $\mathfrak A$, where the variable $x$ is translated as $s(x)$ wherever it occurs free, is true.
In our example, if we consider $s$ such that $s(x)=1$, we have that :
$(x > 0)[s]$ is $1>0$, which is true in $\mathbb N$, while obviously $\forall x (x > 0)[s]$ is false in $\mathbb N$ [because not $0>0$].
Thus :
not $\mathbb N \vDash ((x > 0) \rightarrow \forall x(x > 0))[s]$
i.e. the above assignment $s$ does not satisfy our formula in $\mathbb N$.
Thus, according to the semantic "convention" regarding formulae with free variables, having found an assignment $s$ such that the formula is not satisfied by $s$ in $\mathbb N$, we say that the formula is not true in $\mathbb N$. [Note. Intuitively, a formula $\alpha(x)$ with free variable $x$ is said to be true in $\mathfrak A$ if every sentence obtained from it by replacing $x$ by an arbitrary element $s(x) \in |\mathfrak A|$ is true.]
Conclusion
Having found an interpretation in which the formula :
$\varphi \rightarrow \forall x(\varphi)$
is not true, we conclude that it is not valid.
This is the reason for the restriction regarding the application of $UG$ ...
Added
In David's answer you can find a different explanation : the key-point is the invalidity of :
$\varphi \rightarrow \forall x(\varphi)$.
As you probably know, there are different proof systems for first-order logic : Natural Deduction, Hilbert-style, ...
But all must be sound, i.e. they must not be able to prove invalid formulae.
In order to prevent this, there are some restrictions needed.
Regarding our example, we can roughly say that the problem is connected with the interplay between Generalization (your $UG$) and Conditional Proof (or Deduction Theorem).
Thus, different systems adopt different restrictions :
- we can have (see my answer) an unrestricted Conditional Proof and put restrictions on Generalization,
or (see David's answer) :
- we "prefer" an unrestricted Generalization, in which case we need restrictions on the Deduction Th.