The accounting firm that prepared/signed the return is not one of the very large CPA firms. I assume that they did not do an actual audit of the Foundation's books. (Independent audits of non-profits often only take place if an outside entity requires one.) It is possible that the Foundation accountants just kept track of the activity and did a compilation of its transactions at year end, giving that they are simple ones on the face of it. The fact that companies were making contributions to his foundation in lieu of paying him fees is not something that would show up on the books. Similarly, the donations being made by the foundation were indeed going to actual charities: it was the underlying reasons for the 'donations' where the problems arose.
It's certainly possible that someone at the Foundation's accounting firm had an inkling of it, but it's also possible that they did not.
It may be that he uses a different firm for his principal tax work, assuming that he uses an outside one. Whether or not they would see the foundation's transactions is unknown, but they would probably have no need to do so, since it's a separate entity unrelated to his businesses, and dollar-wise, (probably) immaterial to them. However, I would be a little surprised if an attorney of his had not weighed in on his exposure regarding the fees redirection. (That's the bigger problem IMO, since it may well be a willful tax avoidance scheme.)
On the other hand, given that this Trump, who the hell knows what he told people.
As to the exposure of any lawyer or CPA who knew about this: My guess is that no one involved ever expected the 990s to be scrutinized at the level of detail required to reveal these particular problems. It only came about because Trump decided to run for president. Prior to that, the risk of this being outed was pretty limited.