Suppose I was selling a "mod" of an app. You'd purchase the mod, download it (app not included), and run its installer to inject it into the desktop app, so that every future launch of the app would include the mod. The mod would contain only my code, and no one else's. Would this be legal? I am an American. The app in question is a popular electron desktop app.
The purpose of this "mod" appears to be to create an unauthorized derivative work of the original copyrighted app. Running the mod and thereby creating such a derivative work would be copyright infringement unless fair use or another exception to copyright applies, and there is not enough info inn the question to come to any conclusion on that point.
Creating the mod itself would seem not to be infringement. However, distributing it with the intention that others, running it, will create such a modified version of the original app might well be contributory infringement. There are signifgicant possible problems here that the answer by user6726 does not address.
Since what you are distributing is (by your stipulation) entirely your own creation, you can sell it or give it away as you like. You can't include portions of the host program without permission of the copyright owner. I also don't address the possibility that you are contractually prohibited from doing this (creating you program requires use of software licensed under the condition that you not use it to engineer add-ons etc). This is analogous to writing a Word macro, which takes advantage of the fact that Word can execute programs.