How the creator of Grey’s Anatomy, Scandal and Bridgerton battled loneliness—and unlocked her most creative work yet.