We somehow have this backwards, possibly due to dhoti shivering and/or chalta hai attitude. Both economy and security needs to work in lockstep.
Vijayanagar empire, arguably the richest empire in the world at its peak, was very well known for it's trade/economy/business/culture/art. The focus of the administration largely shifted towards commerce and look how well it worked out for them. They literally just ended up being footnotes in some NCERT history text books. If they had spent the requisite amount of wealth on their army/navy/security apparatus, they could have probably spared us the ignominy of mughalistan and British raj. But then we are like this only!
The fact that , we were always unlucky .
Look at japan, they too traded with dutch and Portuguese .
They acquired western weapons and ship building techniques and through just right mixture of beneficial xenophobia they survived .
Yes xenophobia is bad to those who have been always walked upon by others .
The portugese were stopped at Okinawa and dutch at kagosima
Which is in satsuma or chosu prefecture of japan , see when you read their history .
They bayed for each other blood but they knew " gaijin " evil , so " gaijin" be exterminated .And they did .
Always.
They never allowed spread of christianity , were so far away that islam never reached them so that was one thing less .
The rapid modernization of japan was driven by fear of gaijin domination
They would have been a world superpower today , had the IJA prevailed in 30s on which route to take for invasion .
They advocated the westward push , they lost at khal khin gol to sovets but did control china to a very large part .
The IJN again this time failed at pearl harbor and midway , had they won there, then world history would have been very very different.