Have had toe same EPB issue myself several times, each one being thoroughly inconvenient! Have replaced battery and rear brake pads and still the fault would appear, albeit occassionally. Fault never appeared when car had been standing overnight or longer and only ever occurred during a break/rtest in reasonable length journeys (1 hour+). Has AA man out, had car's fault codes analysed etc etc. Car take to Jag main dealer .....fault occurred when with them but still nothing on fault codes.
EPB electronic control module changed (unit cost approx £200) = no further recurrences of the fault. Very happy.
I noted that when the fault occurred at the Jag dealership they didn't go through disconnecting the battery and then resetting all the electronic but just disconnected both connectors to the electronic control module (boot, RHS behind panelling.) Also, some video footage of another routine here: