Just a quick update. I have swapped the X motor, the X motor cable and the X motor driver. After 5 hours or so into a 2 day print, I thought the problem was fixed, only to discover two minutes later that the same error had occurred.
In order to rule out the error being caused with something gone wrong when flashing the firmware, I rebuilt Klipper and reflashed the board. Also this didn’t change anything. The printer can be printing successfully for hours, with the tmc drivers at normal operating temperatures (between 50 - 60 degrees celcius) and then throw this error all of a sudden. And as mentioned earlier, that is when the temperature of the tmc driver goes through the roof (only after the error). It seems it gets locked into a state where it keeps heating.