This seems to be a classic question in the drupal world, did you search already for similar posts?
Here is what my research provided:
This is a two-fold issue, you can start by working on the Client-Side, but to avoid duplicates, you should ultimately work on the Server-Side. Here are what I found to be the "best practice" ways to go about this problem.
Client-Side:
Client-side solution: https://www.drupal.org/project/hide_submit
But what if the javascript is not there?
Server-Side:
Closer to the direction you started out with:
http://drupal.stackexchange.com/a/152181/57183https://drupal.stackexchange.com/a/152181/57183
I would apply both approaches, starting with the "Server-Side" approach.
Good luck!