I've published a couple of novels. They've sold far better than average, and yet not sold enough to be remotely worth it if I did it for the money. Piracy might have made a tiny dent, but the many millions of competing novels matters far more.
Anyone who has self published will have experienced that it is hard to even get people to read (as opposed to just download to hoard) your work even for free.
It's more comfortable to blame piracy, though.
If you're writing for money, maybe. If you're writing for the love of writing, it won't.
More, you hear of authors who encourage their books to be made available without DRM, who know or silently encourage their books to end up on torrent / library sites. They want their books to be read.