Although what Google did is probably not outright illegal, the /optics/ of this are not great and play in Epic's favor - the fact that these agreements were secret until the litigation started adds credence to their claims that Google has been doing all sorts of fishy stuff to keep a stranglehold on things.
Google clearly determined that a potential fallout from this evidence leaking would be too little, too late. Top notch corporate strategy.