Why are the most recent posts not appearing in a fetch request, unless I’m logged in?

It turns out this is due to SiteGround caching data, in particular its Dynamic Cache. According to their docs on Dynamic Cache, they will “… monitor whether your browser has these cookies and bypass the cache if they are present”.

One of the cookies they check against is wordpress_logged_in_, which explains the behaviour I described. When I flushed this cache manually, the new posts were fetched as desired.

It’s unclear whether this has anything to do with filemtime, perhaps it’s mere coincidence.

I tried searching for ways to programmatically purge the Dynamic Cache (on post save hooks, for example), but couldn’t find any useful information. So, the easiest solution by far was to install the SiteGround CachePress plugin, which takes care of all cache types that can be found in the SiteGround site tools.