Open source is like a club, the more you help the better it gets.
I think you script is a good start and a fast fix for the problem. The better solution is to improve the darktable LR import. That’s more work, harder to code and you need to wait for the next release, but then it works for everyone.
@phweyland is at the moment trying to improve the LR import module in darktable. Perhaps you can work together and help to improve it.