I think your response was acceptable. In the Bible, if someone unclean spat at you, you would also be unclean and would have to wash yourself and your clothes (
Leviticus 15:8). In the case of Miriam, when she criticized Moses for marrying a Cu****e woman, and she was punished with leprosy by Yahweh, Yahweh likened it to Him spitting on her face (
Numbers 12:14), and she had to stay outside the camp for 7 days before coming back in to the camp.
Yahweh's Law is about hygiene too, about making a distinction between the clean and unclean. I think it's good that you naturally thought you had to shower and change after being spat on.