In the very short term yeah, but in the long term GAAP still sniffs this out. Eventually Company A will need to use some form of mark to market valuation to assign a value to that $1M they invested. If Company B is a dumpster fire then eventually the $1M investment will be worth much less (or zero) and balance is restored to the world.

You see companies hand waving this sort of thing away on earnings calls when they have a really bad quarter but the CEO is blowing smoke at shareholders saying “On non-GAAP this was an amazing corner.” Which is code speak for “that terrible decision I made a few quarters ago is coming home to roost and our lawyers have said I need to reflect that on our books. If you ignore where we screwed up badly, our numbers look good!”