Does mastery score take length of game into account?
If not, than it should. In most of the games that I do good, the enemy team surrenders early on. This makes it really hard to get an S because at that point, you'd only have around less than 10 kills, and you need a lot more to get that S.
But, if the algorithm knew that the game was pretty short, it might still give an S for the good early game performance