WillS,
I experienced the same thing on my 1985 S2 27 and although the mast and keel plate were both aluminum, the mast pitted and had to be trimmed 1/4 inch to get rid of the pitting, actually small holes wearing through. I believe it is caused by an accumulation of salt air over the years, water from mast leaks and condensation and yes, some type of electrolysis between the opposing metals.
I corrected mine by placing masking tape around the mast 1/4 inch from the bottom as a guide and trimming off the bad section using a sizzler disk on a grinding
wheel. If you have a steady hand, the cut is perfect and very clean. Next, I painted the inside of the mast with three coats of Awgrip and removed the keel plate to clean it with a high speed wire brush. When all was done, it looked like new.
As to how to remedy the problem from ever happening again, I''m just as puzzled as you and hope someone out there with a degree (laugh) can help us both. GOOD LUCK!