I think Adam Mastroianni has done a fine job critiquing peer review as a barrier to entry and as a service to paper-readers, but that's not how it really functions in practice, for better or worse. Peer review is a system by which random, anonymous paper-writers are able to force other researchers to read their work. In other words, peer review is a service to paper-writers. It is especially a service to paper-writers lacking prestigious affiliations and notable previous work — authors whose papers would go unread if they just posted on arXiv. So in this sense, peer review is a path to entry, not a barrier to entry.