Also, those wires might be for an alert system to flag any unsecured doors. So you shouldn’t have any embarrassing incidents of flooding due to someone forgetting to close the doors as has recently happened to the IN for example.
These are warships, so would not be taking any small arms fire that might damage those cables. The kind of ordinance people would be shooting to warships with means it won’t matter if the cable is internal or external if there is a hit.
As for why it is outside, I think that is because the door opens outwards.
If you had the cable inside, you run the risk of the cable getting caught when the door closes in on it.
While still technically possible, it would be a lot less likely to get caught on the outside.