Posting on arxiv is useful for making results available early, and to make published work available in some form that isn’t pay walled, but posting on arxiv on its own is not publishing as it isn’t peer reviewed.
> Why don't people just publish through Arxiv?
ArXiv is not peer reviewed.
because while that might make sense at the field level, it relies on scholars getting credit for that work, which few do.
Could you elaborate on what you mean by scholars getting credit for their work?
Very few tenure committees, funding agencies, etc. give equal weight to an arXiv pre-print and a published paper.