Bad years? No, no, no. They got their 4th year trophy all those years. For Dortmund it's different. Their star players leaving every season, injury problems, new signings been a failure (so far), tactical issues etc.
It's good for both parts. What Klopp did for them cannot be understated. Brought them back in the top in German Football and made a name of himself and BVB again at the continental stage too, but I doubt he could've managed to rebuild everything again.
This season has been a disaster for them and they now need to rebuild their entire squad and it's the better for both of them to leave eachother's company. Klopp has done whatever he could for BVB, but now was the right time to move on.