The 5 million record limit is a Data Loader memory limit, not a Salesforce limit, and I'm pretty sure that's more of a "suggested maximum per file" than a hard limit. The maximum records you can theoretically load in 24 hours is 200 times your API Limit (found in Setup > Company Information). This value is scaled depending on the number of ...
I think you can not call JS from a button in Lightning.
When transitioning from classic to lightning one of the things you should take care is exactly that.
SF considers calling JS from a button to be security risk and hard enforce good coding practices there.
You should design the same functionality using hopefully Process or Flow.
If they are not ...
Consider using Dynamic Actions. You'll need to have a (typically Checkbox) field that tracks that the given action has been performed against the current record. If you do this, you can use this field in the action's visibility expression.