Its was probably either a fungi/bacterial infection, too much water, or most likely all three. When you graft a cacti and give it a lot of water it bloats and the skin gets thinner making it easier for pathogens to infect it. Even if you used a sterile blade when you grafted it, spores and bacteria are everywhere and it is inevitable that some will make its way onto/into it.
If it were sunburn or damaged caused by too much light it would have been more even most likely. I think you did the right thing amputating it before it spread any further. I highly recommend that you treat the exposed areas with some sort of antibacterial powder to prevent future infections.
There are lots of natural things you can use that will help prevent future infections without harming the graft. A lot of herbal oils have antimicrobial properties and sulfur powder has antimould properties. If I were you I would make a paste and smear it on.
I don't think it was your fault that this happened to be honest. Sometimes its just sheer bad luck. You could try being more clean when you make grafts in the future and use some type of antibacterial. I'm just spit balling but maybe neosporin would work for this purpose. I'd have to check the ingredients, but it would be awesome if it did. Its cheap and readily available. Hell, we could probably use it in place of Vaseline to hold on grafts and hold in moisture.