I'd say that they are mainly there to create a sense of belonging among kids uprooted and moved away from home. This does involve competition in sports, and other things, and, inevitably, a degree of looking-down-the-nose at other houses. But on the whole the positive is supposed to outweigh the negative, and certainly could. I think the main reason the system can look bad in the novels is the need for villains, which can then be reliably associated with Slytherin.I mean, besides intramural sports, what purpose do the houses serve? As it, even considering sports, they seem purpose built to create animosity and rivalries between students.
Also, part of the appeal of the books is that they are part of the English boarding-school genre, with magic added in. The specific houses are made up of course, but the house system is (or was) found in many U.K. boarding schools. Taking them out of Hogwarts would distance the books from their source material, and (I'd guess) decrease their attractiveness for at least part of their audience.