It's not a complete answer but I hope that it could be of some help.
You could rewrite the first system as
$$
\begin{cases}
P(n) = K_P E(n) \\
I(n) = I(n-1) + \frac{K_P}{T_I} E(n) \Delta t \\
D(n) = K_P T_D \frac{E(n) - E(n-1)}{\Delta t}
\end{cases}
$$
Where \$E(n) = G(n) - target(n)\$ and \$\Delta t\$ is your sampling interval. Note that \$T_D\$ and \$T_I\$ are not defined as gains. \$K_I = \frac{K_P}{T_I}\$ and \$K_D = K_P T_I\$ are respectively the integral gain and the derivative gain.
Now you can rewrite the system as a single function of the error.
$$
PID(n) = P(n) + I(n) + D(n)
$$
$$
I(n-1) = PID(n-1) - P(n-1) - D(n-1) \\
= PID(n-1) - K_P E(n-1) - K_P T_D \frac{E(n-1) - E(n-2)}{\Delta t}
$$
$$
PID(n) = K_P E(n) + PID(n-1) - K_P E(n-1) - K_P T_D \frac{E(n-1) - E(n-2)}{\Delta t} + \frac{K_P}{T_I} E(n) \Delta t + K_P T_D \frac{E(n) - E(n-1)}{\Delta t} \\
= PID(n-1) + K_P \left(\left(1 + \frac{\Delta t}{T_I} + \frac{T_D}{\Delta t} \right)E(n) - \left(1 + 2\frac{T_D}{\Delta t} \right)E(n-1) + \frac{T_D}{\Delta t} E(n-2) \right)
$$
The second one is a bit more complex to rewrite as a single equation but you can do it in a similar way. The result should be
$$
R(n) = K_1 R(n-1) - (\gamma K_0 + K_2) R(n-2) + (1+\gamma) (PID(n) - K_1 PID(n-1) + K_2 PID(n-2))
$$
Now you only need to substitute the equation of the PID in order to obtain the equation of the regulator as function of the error.
The bilinear transform will always provide equal orders of numerator and denominator polynomials in the ZTF. A good alternative is to use pole and zero mapping, via z -> exp(sT), with appropriate adjustment of DC gain
Best Answer
There are several ways to convert a transfer function into a state space representation. They lead to apparently different results, but retain the same essential information.
Possible representations:
_ First companion form (controllable canonical form).
_ Jordan canonical form.
_ Alternate first companion form (Toeplitz first companion form).
_ Second companion form (observable canonical form).
There is no single set of state variables which describe a given system. Different sets of variables can be chosen. It is possible to transform one set into another (ie linear combination).