Basically, two players committed a foul in the same inning.
My understanding is... only the shooter can commit a 'regular' foul that results in ball in hand.
For a player to 'foul' from the chair they basically have to do something unsportsmanlike.
There aren't any standard 'ball-in-hand' fouls from the chair.
----
In the past, I've heard that there's a special 'loss of game' or even 'loss of set' penalty for unsportsmanlike behavior. Maybe that's in older physical copies of the APA rules. But if you look at their latest online rules, there's
nothing written about intentional fouls or special penalties.
http://www.poolplayers.com/8-9-ball-rules.pdf
Well, almost:
Teams involved in repeatedly calling bad hits without outside party verification may be subject to penalty points for disruptive unsportsmanlike behavior.
So, there's only one case where they talk about special penalties, and the penalties are points. I have no ideas if that's match points, or game points, or what. It needs to be explained a little better.
Since the rulebook doesn't really spell out any harsher penalty than ball in hand, and since the guy in the chair fouled second (and was borderline unsportsmanline),
player A should get ball in hand. Player B shouldn't.
The reasoning is that player B's foul was more egregious... because his foul altered the outcome of the game and possibly the match. Maybe the CB was going to run into a 9 ball and hang it near the hole for an easy combo. Maybe it was going to break out a cluster. Maybe it was going to relocate a ball somewhere that changes the rack from a cosmo to mission impossible. The whole set is tainted by that one action (even if it's not intentional).
If a guy is hooked and tried to kick a ball, and hit some other ball first, nobody would even consider grabbing the CB before it came to rest.