It is simple.
“If you’re a pirate—or a competing European power—and you want to get your hands on that wealth, you’re going to attack the weakest points between Veracruz and Spain. If you’re Spain, you want to protect the loot all the way to Spain.”
https://unchartedterritories.tomaspueyo.com/p/a-brief-history-of-the-caribbean