Solution 1:

The local files have no domain. You can verify it by opening the console with F12 when displaying a local file and executing this command : console.log(document.domain).
So we can restrict extension when there is no domain :)

Open a new tab and type about:config in the address bar.
Accept to take risk when Firefox warns you.
In the new window, search for an option called extensions.webextensions.restrictedDomains. You will see that there are already several domains listed here, mainly around Mozilla websites. Edit the value and in the end, append a simple comma :
restrictedDomains option ending with a comma

From now on, Firefox will restrict extensions for pages that have no domain, including local files.