As part of the batching code, Mediawiki API responses are being cached on a per-request basis. This assumes that the API responses are pure functions / stateless. In the general case, that is not true. For example, there could be a time parser function that is used multiple times on the page, or a template that invokes a random number and is used multiple times on the page. So, it seems that caching is not safe. However, Tim clarified that in the PHP parser, lots of things are cached on a per-page level. But, there are exceptions, and then there is the volatile keyword.
It would be good to adequately document this caching behavior which helps us reason about correctness across implementations and also reference it when making changes.