This is not to say that people are "perfectly rational." "Perfect rationality" as a statement of human nature, as distinguished from a theoretical device, makes for evolutionary nonsense. Had hominids sought to achieve perfect rationality in their decisions, they would have died out as they spent all of their time refining their cost/benefit calculations: Spending too much time calculating the possibility of outrunning a velociraptor would, no doubt, have had dire results. Perfection in choices is impossible, and uneconomical, just as, in a world of scarcity, developing a perfectly safe automobile is impossible--and uneconomical.
People, including economists, are imperfect decision makers because of their mental limitations. But this fact does not mean that markets fail. Indeed, markets do far more than induce improved allocation of resources, given wants and resources. Markets induce market participants to be more rational than they otherwise would be because they must pay a price for being irrational. Thus, markets allow--no, require--economists to assume that people are more rational than they are likely to be found to be in laboratory settings, absent meaningful information and incentives and absent market pressures.
This is from the featured article for this month on Econlib. In it, Richard McKenzie tells how he tweaks some behavioralists' well-known experiment that they use to show people are predictably irrational. When people have time to talk about the experiment, guess what, they actually learn things.