Potential problem were expected and planned for with Voyager 2's flybys of Uranus and Neptune. Because of the long exposures required for these more distant planets, like you pointed out, the engineers had to account for the attitude effects of both (i) the DTR movements and (ii) panning the cameras to keep them focused on a single point while the spacecraft was moving past at high speed. This was especially a problem at Uranus, which is tilted on its side. Voyager 2 was approaching at its north pole; with the plane of the moon's orbits perpendicular to the ecliptic - like an arrow flying into an archery target. As a result of this configuration and Voyager 2's high speed, the high-resolution observations of Uranus and its moons were compressed into a 6-hour period.
These engineering efforts are described in detail in a 1985 paper, "Voyager Flight Engineering: Preparing for Uranus", by W.I. McLaughlin and D.M. Wolff. Abstract: https://arc.aiaa.org/doi/abs/10.2514/6.1985-287 (The full paper can be found online with some effort; doi:10.2514/6.1985-287) Here's a quote from the paper (AACS is the attitude control computer and CCS is the command computer):
"The DTR is mounted on the spacecraft such that its angular momentum is introduced into the yaw and pitch axes of the spacecraft with almost none going into the roll axis. DSSCAN was first programmed to introduce cancelling momentum in the yaw axis only. The modification to the AACS and CCS software took place in an environment of a scarcity of available memory so that, from a programming point of view, it had to be carefully fit in. The "patch" was carefully tested in the Voyager Capability Demonstration Laboratory (CDL) before loading onboard Voyager 1. (The AACS and CCS programs were modified without being reassembled as is the case with all AACS and CCS changes since launch.) The CDL is a digital/analog simulation of many of the spacecraft capabilities. Modifications or tests of any degree of complexity are done first, whenever possible, on Voyager 1 before implementation on Voyager 2, a reflection of the fact that Voyager 2 still has two planetary encounters scheduled while Voyager 1 has none."