A miscalculation is still a mistake. If their intention was to get him convicted, regardless of before or during election season, their slow-walking failed. They made mistakes.
You are correct about friendly judges. I don't know enough about lawyering to know if there was a way for the DA to pick better venues with less friendly judges.
You might be surprised what the feelings are of people in the Pentagon vs those in the services at large. The Pentagon is filled mostly with officers, not enlisted people. Officers are college educated and are responsible for leading teams of people. They take their oath of service EXTREMELY seriously, and seeing a commander in chief who spits in the face of this oath is not taken lightly. Seeing a commander in chief who risks the lives of their people for questionable reasons is not taken lightly. I was in the Pentagon the month before and the day after election... most people there are not Trump voters.