I would not suggest you follow this advice. To begin with, you might wind up spending a lot of time writing something that can't be published
Can't be published
without making some changes, that is, as advised by lawyers. In other words, you write it, and then based on the lawyers' advice, you rewrite parts of it. Not a big deal. You're going to have to make changes based on the editor's advice too--it's just part of publishing. It's just that the lawyer's advice is going to be along the lines of "maybe you should combine these two characters into one and make him a different age, so that he's not so obviously your ex-husband Dwayne T. Psycho."
If you censor yourself from the get-go and don't write things for fear of legal repercussions, then the end result is... you don't write the book! It makes no sense to do that, especially since it's very difficult for a layperson to figure out exactly what it's okay to write. (There are some obvious rules, but what I mean is it's hard for a layperson to figure out everything they need to know in order not to risk a lawsuit with their book--that's what the lawyers are for: telling you once you're done with the book what it is that you need to change.)
First of all, this is not something lawyers -- other than ones you hire -- deal with. This isn't like a simple (?) line edit, this is serious stuff and it's the responsibility of the writer. Neither agents or editors will touch such a work without first having the proper permissions and/or written waivers.
That makes no sense. There's no law against an agent or editor reading an unpublished manuscript that defames/libels someone. Writers of memoir and autobiography typically do not get lawyered up and spend thousands of dollars having their book vetted before they even submit it to an agent--that approach would simply not make economic sense (for anyone except lawyers, that is). What makes sense is to (1) take care of obvious legal issues up front (i.e., change characters' names/ages/major identifying details); (2) submit to agents; (3) take care of any slightly less obvious legal problems that the agent happens to spot; and then (4) IF it gets bought, the publisher's lawyers will look at it because the PUBLISHER is just as liable as the author is, if it turns out the book defames/libels someone. (Your contract may require you to pay back the publisher if your book gets them legally screwed, but if you get sued, so do they, and the hassle of litigation is something they want to avoid, so obviously they have their lawyers look at the MS before it's published.)
That's how reputable publishers behave, anyway.