To restate the issue, B has taken some free but non-copyleft software and produced a modified version, which they are distributing as a commercial (and therefore proprietary) product. A has bought a copy from B, and acquired their permission to modify it for in-house use. A's modifications include the addition of some GPL software. You want to know if all this is lawful.
The in-house use and modification of software received under GPL is perfectly lawful; the GPL FAQ is clear about this, as are many other sources. You tell us that B has licensed the right to make derivative works of its software to A, so A is clear on that score also. The resulting combination of B's product, GPL libraries, and in-house work by A is clearly un-redistributable, but in-house usage of it should be fine (note that "in house" probably doesn't include contractors, who cannot lawfully receive copes of this code).
IANAL/IANYL, though, so A should take professional advice before betting a business on this.