Lenition and logic
Just out of curiosity is there any logical reason as to why certain grammatical rules apply in certain instances?
E.g. why do feminine nouns get lenited after the definite article 'an' in the nominative case, but not masculine nouns?
Is there any particular reason why this is so, or is it simply a reality of the grammar that must just be accepted?
Today they are just grammatical rules that can't be derived otherwise, but if you're interested in the origins of the mutations, of course there is a historical reason.
In your specific example of the definite article, the difference goes back to a time when the article was longer than just an and differed between masculine and feminine nouns, so there was an actual phonetic reason why one article would cause lenition and the other wouldn't. It is also why preposition + article cause lenition or eclipsis, this originates in the old dative and accusative forms of the article.
GnaG has a short overview about the origins of each of the mutations: http://nualeargais.ie/gnag/sindos.htm