That's all there is to the mechanism, and normally it works as desired, but let's consider some of the implications. Advertising often tries to get you to associate products with some widely desirable concepts (money, sex, etc.) even when there is no legitimate, useful, or causal relationship between the two - just by bombarding you with imagery and hoping that the concepts remain in your mind together long enough to become associated.
In order to learn from experience, you need to have both your actions and the result in mind at once. This may seem trivial, but it means that if you don't remember what you did anymore by the time you get the results, you won't learn anything. It also means that if the results are sufficiently far removed from your actions that you can't tell which actions caused which results, you will fail to learn.
This results in some interesting situations in which someone who fails to learn something as a child can't ever manage to learn it as an adult either. Children often get things explained to them in detail at the time, such as when they're told "no, Johnny, that was bad. That makes mommy very angry!" From this, they acquire concepts for mental states like "angry" and associate certain aspects of appearance and voice with them. Suppose, however, that one makes it to the point of being an adult without having acquired an adequate set of concepts to represent other people's emotional state. Once one is an adult, people no longer explain that you have made them happy or angry; you are expected to already understand this. Thus, such a person could observe his actions, and could observe the actions of other people around him, but could not perceive or represent the mental states of the other people. In this case, it could be extremely difficult to relate one's actions to other people's responses in a meaningful way; without the intermediate layer the actions and results are too far removed to correlate.