Find trigger behind occasional php undefined error

The function in question is defined in general-template.php, which is loaded unconditionally in wp-settings.php. In other words it should be available in almost any WordPress core load (outside of very rare custom loading routines).

My educated guess would be is that some bot simply pings that index.php file directly, without going through WP URL and proper core load. You can likely confirm this by digging for those hits through your web server’s access logs.