All of these men have only recently retired from service. There's a reason why with the Defense Department a retired general is not permitted to serve as Secretary for seven years post-retirement. Mattis is getting a waiver. Concentration is the key issue. I cannot think of any time in history when an administration has been so dominated by retired generals.
To look at the question precisely, it is hard to make direction comparisons prior to the 20th century, perhaps even the mid-20th century. That is because the country simply didn't have the robust, permanent standing army we have had since World War II. One might be able to find vaguely comparable instances in the late 19th century when the great majority of prominent politicians had served in the Civil War and more than a few had risen to a general officer rank. But even with all this, this is completely unprecedented.
It is also worth noting that in the 19th century, American culture was far more sensitive to civilian control of the military and wary of standing armies.
What adds to the complexity of the matter is that other than Flynn, who is dangerous and has dangerously poor judgment, Mattis and Kelly and (if he's nominated) Petraeus are some of the more accomplished and experienced people Trump has nominated. This is a very low standard. If it weren't Mattis at the Pentagon, it might well be some charlatan Fox News commentator: that's who is the deputy running the NSC. This doesn't change the equation. It is just a practical recognition of the situation that we're in. We could probably do much worse.
One additional dimension to these picks is that each man appears to have clashed with the Obama administration. Again, in itself, that's not a problem. Career officers are there for their experience and knowledge. Sometimes there's a conflict of views. If the general officer can't conform to administration policy that may lead to an honorable dismissal. It is also normal that an incoming administration will appoint or nominate people who differed with the previous administration when it was of the opposite party. But it's a bad pattern to make generals locking horns with one administration become a vehicle for preferment in the next, if it is of the opposite party.
As I've said, the real and immediate danger is Flynn. He has displayed poor and erratic judgment, a willingness to believe and peddle the most outlandish conspiracy theories and none of the judgment and sobriety his new position requires. He's trouble. The others may do very well in their positions. But as a pattern, a government dominated by recently retired generals is a very negative development. Even if the nominees in question are not part of his thinking, there's little doubt that Trump's decision to nominate so many generals is rooted in a mix of his own lack of military service and his instinctive inability to think of relations between people or nations as anything but ones of domination.