There is limited train service in Croatia and Montenegro, so your choice will often be between driving and taking a bus. I used the buses a lot and found them reliable, but you're stuck with their schedule and it can be difficult to be sure you have reliable schedule info without going to the local bus station and checking in person.
No matter what form of transportation you choose, I wouldn't stay in Dubrovnik so long and make multiple trips down into Montenegro; much as I'm not a fan of changing hotels often, I don't like going back and forth down the same highway, day after day. Lodgings will probably be a bit cheaper in Montenegro, too. In addition to Kotor and Budva, I liked Herceg-Novi (even closer to Dubrovnik) and the Turkish-feeling Ulcinj (beyond Budva, perhaps pushing it, time-wise). The interior former capital of Cetinje is interesting, too, but again you may not have time. Several others on the forum really like Perast, just up the coast from Kotor, but it was a bit too small and quiet for me; perhaps it would be different if one spent the night there. But if you're using buses, I suspect Kotor will work out the best since it seems to be more or less the bus hub along the coast.
If you decide to keep the car and drive to Montenegro, be sure you clear that with the car-rental agency; you should do the same with the little bit of Bosnia-Hercegovina you have to cross between Split and Dubrovnik. Neither should be an issue, but I think the international crossings have to be documented.
For what it's worth, Zagreb-Ljubljana-Bled-Zagreb can be easily managed by train/bus. A car would be advantageous if you wanted to do much exploring beyond Lake Bled, but it doesn't appear that you plan to do that.
I've never had the benefit of a car in Europe, much less in the specific area you'll be visiting, but I have been to most of your planned destinations, and I think you do have too much for 3 weeks. Exactly how many nights will you have on the ground? I think you might just about be able to do it if you left out Montenegro or if you left out Slovenia, though it depends on how much time you want to spend at each stop. (Any lying-on-the-beach time? I never allow for that.)
I enjoyed Istria a lot and think it's worth at least four nights (and considerably easier with a car). Since you clearly don't have time for that area this time, perhaps think about a future trip. What would combine well with Istria? Answer: Slovenia, Venice and other destinations in NE Italy. So I guess I'd be more likely to retain Montenegro and postpone Slovenia. Unless you have a burning desire to see Albania in the immediate future?
If you can't bear to dispense with Slovenia or Montenegro, you'll need to whack away at Croatia. I liked Zadar, but it's sort of a mini-Dubrovnik without the walkable wall, so you could skip it (heaven knows, almost all American tourists do). You could skip Krka, having seen Plitvice. Now you're down to how well you can make the island transportation work for you; that's something I haven't looked at in 20 or 30 years.
Ljubljana and Zagreb, incidentally, are both really nice cities. I think each is worth more than one full (non-jetlagged) day. Zagreb, in particular, has a lot of interesting museums. I'd suggest checking out the museum options there before deciding how many nights to spend in the city. I particularly recommend the small but excellent Museum of Naïve Art and the very entertaining Museum of Broken Relationships.