Reason to have index.php in some paths

I am new-ish to NextCloud, and have seen lots of questions on this board related to hiding the /index.php/ portion of some URL paths in NextCloud. I was wondering if somebody could explain to me why this is included in the URLs to begin with. Does it have a benefit or purpose to the way the application works?

I am asking because I am running into some problems with overriding certain parts of the web app files with my custom theme files (EXAMPLE: I want to edit the breadcrumb.js file but the only relevant file loaded to the page is /index.php/js/files/merged-index.js making overriding the file difficult just by changing the /core/apps/files/js/breadcrumb.js file in my theme directory, as these paths do not match and do not override one another.

I am thinking that if I make the URLs “pretty”, and remove the index.php reference, that the loaded sources will no longer contain the index.php/apps/files directory and I will be able to match my template file structure to the loaded structure. Is this OK logic?