The only real solution here seems to be to find a way to hold HackerRank to account for this (in the most costly way possible), so they face an incentive to do meaningful due diligence and evaluate before partnering with someone that acts as their agent.
Ultimately it wasn't them that did this, but unless they bear a significant cost from doing so, which causes them to pursue their DMCA agent for negligence or breach of contract (or whatever other remedy is available to them), I don't see this type of thing changing.
Once a DMCA agent becomes a liability, the market will be forced to mature, and buyers will need to do due diligence to minimise their likelihood of being opened up to a large and costly battle as a result of the negligence of their agent.
Maybe there’s a case for a consortium of open-source projects that can pool its resources and serve as an insurance policy to fight back against license violations or malicious/stupid DMCA takedowns.
Open source projects should have a kind of union of their own. Then again I wonder if it would ever be possible because corporate money has became a key donation source and in many cases many OS projects themselves have become corporatized.
https://en.m.wikipedia.org/wiki/Software_Freedom_Law_Center
https://en.m.wikipedia.org/wiki/Software_Freedom_Conservancy
> If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate.