I would say it's definitely the dog that is freaking him out. Poor boy
Are the litter trays in areas that are dead ends? If so he may just feel too vulnerable to use them with the dog around. Could you try having an area/room/upstairs that the dog cannot access and is only for the cat and have a litter tray there? You need to look very critically at the location of the litter trays and make sure he can always have multiple escape routes from them so he does not feel in danger. He may use them to pee to try and mark his territory but not feel confident to do the other or maybe pooing to mark territory. Whatever the reason, he is territorially insecure and needs help. He is not doing it to be naughty. I really hope others on here have suggestions also to help him achieve appropriate litter box habits. You could also try, if you have not already, cat trees, shelves and high up safe areas for him to increase his confidence. Good luck