How can I attach a handrail to the wall so that it will be easily removable?
I solved the same problem by with t-nuts.  Embed the t-nuts into the stud, or in my case a wooden brace between the studs.  Then attach the bracket to the t-nut with a machine bolt.  I've screwed and unscrewed the bolt repeatedly but because it is metal-to-metal it does not compromise the wood and thus does not wobble.

(I agree this question is different than the one about a removable stair railing because this railing goes into the wall).

I haven't yet figured out how to mount such a wall rail into masonry.  A 2-part or removable bracket, as you ask, seems like a good idea but I haven't found one yet.