Why can't you fix a broken masts when you get it by taking sail damage but you can when you take a broken damge counter?
Because you don't technically have a broken mast to fix.
It is less about fixing the mast as it is that you are out of sail repairs at that point. Once you have had to fix that many sails, you basically treat it is a broken mast as far as game effects go (use the broken mast sail cards). But you can't fix the mast because it isn't the mast that is broken.