If I was going to replace both my cable modem and my wireless router, does it make any difference as to which I replace first?
I don’t think so. I have recently replaced both my cable modem and wireless router and I replaced the wireless router first, only because my cable company offered me a new modem to enable me to update to a faster service.
Buying your own cable modem can save you money (rental from Comcast et al. is typically about 1-1/2 times the cost per year) and give you higher performance, if the cable provider has given you old cheap junk. (This has been a Public Service Announcement.)
But no, you can replace either one at your lezzurr.