OJS does not always respect the disable_path_info setting causing 404s

I have a NGINX setup so have
disable_path_info set = On
which has worked fine for OJS 2 but for OJS 3.

I’m getting unexpected errors popups and the issue is AJAX requests not being sent as an index.php

This request is being sent

/index.php/EXAMPLE/api/v1/_submissions?journal=EXAMPLE&endpoint=/EXAMPLE/api/v1/_submissions

This should be
/index.php?journal=EXAMPLE&endpoint=/EXAMPLE/api/v1/_submissions

The /EXAMPLE/api/v1/_submissions is being added erroneously despite the
disable_path_info = On
setting.

How can I fix this? I don’t mind going into the code if necessary.