As per title really, it confuses me that Ravenna is right on the edge of the WRE territorially, and as a result is rather vulnerable
How so exactly? Ravenne wasn't taken over and pillaged as Rome, for one, while not having particularly important defenses (compared to, say Constantinople)
plus, being at the top end of the Adriatic Sea, trying to go from Ravenna to anywhere else by sea is delayed by the great big ol' boot of Italy.
1) Being close to the sea is actually a major point in favour of its "capitalisation". It meant a close and relatively safe (giving ERE naval supremacy) access to ERE.
2) You forgot to take in account
roman roads and communication lines : its geographical position allowed to move swiftly to the North, to Rome, and generally in Italy.
So whilst a Military capital is probably best suited to being on the border
Ravenna wasn't : it's just that it was better located strategically. As in a place where you can beneficy from quicker movement to "hot" points, and better reinforcements/support from allies.
what if the major peacetime capital was a massively rebuilt Carthage, or somewhere else in Africa.
I think there's a contradiction there : you argue that Ravenna wasn't placed well as it was too far from Central Italy, but Carthage would do fine?
Even disregarding that navigation in bad months was generally a bad idea (especially if it was about crossing troops), that it was far from foedi (you could as well say to Barbarians "help yourselfs, we give up"), having the WRE clearly not beneficing from a that good naval edge, and being a general show of weakness...
It is centrally placed in the Empire
It wouldn't : it would dependent far too much from naval organisation, and would have far too issues reacting quickly to provincial matters compared to land connections.
which would have the Military capital anyway.
You mean having two capitals? One Military and the other "Civil"?
Giving the military nature of the imperium in the Late Roman Empire, I'll approximatly give 3 seconds before the guy in charge of military matters gets proclaimed emperor by his troops, a Roman Senate pissed being disregarded, and populations considering the usurper as the real leader.
Or was Ravenna being on the border a crucial reason it WAS such a useful capital for the WRE?
As a rule of thumb, if something happened IOTL...Well, it was generally for good reasons.