Hi Suncatcher
This is how I see your situation.
1. I see that an anode on my shaft close to my stuffing box had fallen off.
By this do you mean that the anode is actually fitted inside the boat? If so very unique!
2.The anode had no noticeable deterioration (I don’t know how old it is).
If it is fitted on the inside of the boat with no contact to water, you can expect it to last for ever, no matter how old it is.
3. It is missing a bolt which attaches the two parts of the anode to the shaft... so I assume that the bolt had come loose and the anode fell off.
Yes. if it is missing a bolt that is very likely the cause of it falling off.
4. Initially I planned to replace it but then thought...is an anode on the shaft located inside the boat where it will (hopefully) never be submerged, needed?
I too hope it will never be submerged there, So, no. Realistically it is not needed, But.....
5. Does it provide any protection at all?
It provides ZERO electrolytic protection. However, as mentioned by Ted, something fitted to the shaft would stop it propelling out of the tube if the coupling ever gave way.
6. Should I replace it?
Your post has taught us all a new trick. If you have a spare shaft anode you should fit it internally, near the stern tube. That way you will know where it is and in the event of a coupling failure it will keep the prop shaft inside the boat and reasonably safe.
Great idea!
So, get a new bolt and refit as specified.
gary