You can't derive it like that because the proportionality relations hold only when the third parameter is kept constant.
However, you can derive the ideal gas law by noting that for high temperature, we get a limit as shown below:
$$ \lim_{ p \to 0 } p \overline{V} = f(T)$$
So, the limit of the product as pressure drops to zero is a unique function $ f(T)$ for all gases independent of the substance used. We can use this to define the linear kelvin scale. Using the triple point of water and absolute zero as our reference,
$$ f(T) = \frac{f(T_{trip-point})}{273.16K} T$$
Where $f(T_{trip-point})$ is the value of the limit at the triple point, using this and our first equation, we can write,
$$ \lim_{ p \to 0} p \overline{V} = \frac{f(T_{trip-point})}{273.16K} T$$
and now, the universal gas constant is defined as follows:
$$ R = \frac{f(T_{trip-point})}{273.16K}$$
Which leads us to:
$$ \lim_{ p \to 0} p \overline{V} = RT$$
Now, we call an ideal gas is one which obeys the above relation even when the limit is not there.
$$ p \overline{V} = RT$$
Reference: from 10:46 of this video