There are a few situations that any given rule book won't cover because it just hasn't been thought up, this is one of them. In these situations, common sense and courtesy should be the rule.
A player who rakes the balls is conceding the game. Doesn't matter if he's conceding out of courtesy, mental glitch, spite, or accident. The game is over and he lost. If you can lose by unscrewing your cue to signal the end of the game you can certainly lose by raking the balls. Otherwise you could abuse it as a sharking technique or hoping to gain some advantage in the way the balls were replaced.
Does anyone think the apa REALLY wants players arguing for an hour on the replacement of SEVERAL different balls (especially when nobody bothered to memorize their positions)? They put in rules just to avoid this kind of argument, because even a single ball's position can lead to lengthy debate.
Even if the other team wants to be gentlemen and replace the balls to give the guy another chance, the game is completely altered. Little differences are huge when you're talking about the position of a ball... frozen to the rail vs. a quarter inch off... passes another ball vs. doesn't pass... Replacing any single ball incorrectly would screw up the way the game plays out.
I guess Player B's team could be nice and offer to have the entire game replayed. But my feeling is that if a player is so unfocused about the game, he deserves the loss. Another possibility nobody has mentioned: I've seen guys get so upset about a missed ball or a scratch that they rake 'em. Maybe he wasn't confused at all.