The accusations are lurid: A former Yahoo Inc. software engineer says her boss slipped into her bed and coerced her to have sex, threatening her job and future if she said no.

To some, what happened next is even more sensational. Instead of attempting to diffuse the situation, Yahoo’s lawyers fired back publicly and aggressively in defense of Maria Zhang, Yahoo’s senior director of engineering, and backed her in a countersuit alleging defamation and intentional infliction of emotional distress.