Modify the file inside plugin dir – the right way

It is not possible to override a file (not technically 100% true, but you don’t want to go the way that will make it possible), and in any case, if it was possible the long term effect would be similar to the one you are trying to avoid – when upgrding the plugin, the upgrade might not have any impact, since your file will override it.

Good plugins will provide API or filters and actions which will enable you to change their behavior without risking that an upgrade will nullify them. If not possible, and you just have to have the change, just use a tool like git to track your changes, and at least when a new upgrade will arrive you will have easier life when merging your changes into it.