First of all, your statement of the rule is not correct. From Pongworld (emphasis added):
After each 2 points have been scored the receiving player or pair shall become the serving player or pair and so on until the end of the game, unless both players or pairs score 10 points or the expedite system is in operation, when the sequences of serving and receiving shall be the same but each player shall serve for only 1 point in turn.
This is a very different specification from even "every two serves", much less from "every five serves ".
A serve which leads to a rally in which no point is scored (i.e. a let) would not be counted under the official rules, while it would be counted under your specification.
Quite simply, the winner of the point and the number of serves made are both irrelevant. It is the number of points won since service last changed (or when serving first, since the match started) which matters. Whether it was A twice, B twice, each once or that there were fifty lets in between, the serve won't change until two points are scored.
This makes it easy to determine when service will change. Simply add the scores of both players. If the total is odd, the same player serves again. If it is even, the other player serves the next rally.
The exception is during expedited serve, where service changes after every point.