Causal inference is about making inferences about how causes lead to effects. If you have a generative model of the world, you have made some inferences about what will result from some set of conditions.
A prediction, on the other hand, is a guess you make about the state of the world given some conditions. If your generative model makes predictions that match what you actually observe, you have a good model. However, if you have some prediction error, you either need to update your estimate of the conditions (as part of a higher-order generative model), or you need to change your model parameters.
Let's say you have a room with a light switch and a red light. You notice when the switch is flipped, the red light comes on. Causal inference would lead you to think that the switch causes the light to come on, so in the future when you see the switch flipped you make a prediction that the red light comes on.
If you want you can think about this in terms of a statistical model of the form:
Y = β * X
where X is the state of the world, Y is your prediction, and β are the weights in your generative model. Causal inference would be choosing the weights β. Prediction would be obtaining Y given X. If we think about this as a logistic model predicting the probability of red light on (Y) given X (state of switch), our causal inference would lead us to set a very high value for β, which in turn would lead us to predict Y is "on" when X is "switch active".
I do not think "I see a ball about to hit me (X), who threw it (Y)" is a good example of causal inference or predictive coding (if you've gotten this example from some reading I'd be happy to take a look and see if I should revise my thinking). Instead, this would be a case where you have already done causal inference to know that balls flying through the air come from some actor: you know your β, which sets the probability of an incoming ball to very high when X is Greg throws a ball. What you want to do if you don't already know X, though, is to find an X that minimizes your prediction error (Y - Yactual). Your naïve prediction is probably that no balls are flying at you (Y = nothing incoming) given that your naïve X is probably no one is throwing any balls. Once you detect that a ball is coming at you, you have a prediction error (there is an unexpected ball coming at you), a model for the world (balls are thrown by someone), and possible prior states of the world X that produced the incoming ball. You can choose the optimal X by minimizing your prediction error, using your generative model (prediction). If you set X to "Greg throwing ball" and that results in a Y that matches your observation, you update the state of the world to say that Greg threw a ball in the recent past.