I have learnt that $U$ includes all forms of energy, including
translational/vibrational/rotational KE and PE.
Yes, but it is important to realize that the KE and PE components of the internal energy $U$ is the KE and PE associated with the motion and position of the molecules of the system, i.e., KE and PE at the microscopic level. The motion and positions you cannot observe directly. That is why they call it "internal" energy.
It is not the mechanical KE and PE of the system as a whole due to its velocity or position relative to an external frame of reference. I like to call this the "external" KE and PE of the system because they are associated with an external (to the system) frame of reference. These are the $\Delta KE$ and $\Delta PE$ in the general equation of the first law given in @Chet Miller answer.
Additionally, temperature is determined only by translational KE.
This statement can be misleading. Although the kinetic temperature doesn't take into account vibrational and rotational forms of molecular kinetic energy, the specific heats do take them into account, and the specific heats determine the temperature change for a given amount of heat transfer in the absence of work.
However, exercises in my textbook make it out to seem that an increase
in $U$ (whether via work or heat energy) always results in an increase
in temperature as well.
I'm not sure what those exercises are, but an increase in internal energy does not always result in an increase in temperature. For example, adding heat to cause a phase change from a solid to a liquid (e.g, melting of ice) increases internal energy with no change in temperature. That's because the heat addition only increases the internal PE, not KE of the water molecules. On the other hand, heating an ideal gas results in only an increase in translational KE.
How can work done on an object (e.g. accelerating it with a constant
force over some distance in a vacuum) increase the random
translational KE of its atoms?
Acceleration of the system as a whole increases the KE of the system as a whole, its external mechanical KE. The general form of the first law, given to you in @Chet Miller answer, tell us that the total change in energy of the object is the sum of the change in its microscopic internal PE and KE, which constitutes $\Delta U$, plus the change in its macroscopic mechanical PE and KE, the $\Delta PE$ and $\Delta KE$ in the general equation of the first law, like the thrown ball example above.
(Additional question). However, in my understanding $U$ includes both
PE and KE, so if PE was converted into KE there should be no change in
$U$.
If the conversion is between the internal (molecular) PE and internal (molecular) KE then yes, there should be no change in internal energy $U$. But it's not clear (at least to me) if they are treating the 5J of elastic potential energy as external mechanical PE of $\frac{1}{2}kx^2$ (like a spring) or internal intermolecular potential energy.
Hope this helps.
The relevant Gibbs-Duhem relation arises from subtracting thermodynamic differential relation from the Euler equation. Let's consider a 1-dimensional rubber-band for simplicity (so no vector signs). Also, there's no change of mass or particle number so I'll ignore the chemical potential $\mu$.
$$dE = TdS+fdL\tag{1}$$
$$E(S,L)=TS+fL\implies dE=TdS+SdT+fdL+Ldf \tag{2}$$
Subtracting these two gives
$$\boxed{SdT+Ldf=0}$$
If we now regard independent variables to be $L$ and $T$ (as it might be in an experimental setting):
$$\begin{align}
S(L,T)dT+Ldf(L,T)&=S(L,T)dT+L\left[\frac{\partial f}{\partial L}dL +\frac{\partial f}{\partial T}dT \right]\\
&=\left(S+L\frac{\partial f}{\partial T}\right)dT+\left(L\frac{\partial f}{\partial L}\right)dL \\
&=0
\end{align}$$
Now if you want to calculate how much hotter $dT$ a rubber band will get after you stretch it by $dL$.
$$\begin{align}
dT=-\frac{\frac{\partial f}{\partial L}}{s+\frac{\partial f}{\partial T}} dL
\end{align}$$
Where $s\equiv S/L$ is the entropy per unit length.
Best Answer
You need to first express dS in terms of dT and dL, and then to apply one of the Maxwell equations for the partial derivative of S with respect to L at constant T. This leads to the equation $$dU=C_vdT+\left[f-T\left(\frac{\partial f}{\partial T}\right)_L\right]dL$$If f is proportional to T at constant L, then f must be of the functional form $f=T\alpha(L)$. If we substitute this into the equation for dU, we obtain:$$dU=C_vdT+(\alpha T-\alpha T)=C_vdT$$ So,$$\left(\frac{\partial U}{\partial T}\right)_L=C_v$$and $$\left(\frac{\partial U}{\partial L}\right)_T=0$$The second partial derivative of U with resect to partials of L and T must mathematically be independent of the order of differentiation. So, $$\frac{\partial^2 U}{\partial T \partial L}=\frac{\partial^2 U}{\partial L \partial T}=\left(\frac{\partial C_v}{\partial L}\right)_T=0$$ Therefore, $C_v$ for this material must be a function only of T. And, of course, the same must be true for U.