Well it doesn't happen every game. But when it's does; it's rather annoying.
But you do need a lot of units though. If you just have a few Artillery guarding your cities; that's not going to be enough.
My point is; is that if you try to play completely peaceful... The AI gangs up on you.
In that particular game; I was friends with most of the AI.
Then out of nowhere; whole world declares war. The game states it's because of different ideologies; but I don't think so. I think they just gang up on weak civs.
In fact, it seems the AI gangs up on you no matter what. You play peaceful? You're too weak. You play aggressive? You're a warmonger.
I've found a solution though; to just build a whole bunch of units.
The AI doesn't ALWAYS gang up on you. You just have to be aware of the diplomacy. You have to be involved in that aspect. Some parts of diplomacy are counter intuitive like denouncing a universally hated civ is better then staying neutral. Or agreeing to go to war with an Ally against a much weaker friend just because they asked. All these things can actually help your relationship with the AI. You just have to pick the right allies.
America thinks of itself as a super power. No war in the world goes on without America considering how it impacts them. Same with Russia in the 20th century or Britain or France in the 19th. Every international affair affected them too. You have to have the same mentality. Everytime war is declared on your continent. Consider how it impacts you. Consider how they may pull you into war.
Finally there's a few ways you can reduce your chance for war. Send trade routes in their direction. Trade luxuries with them. It will be hard to give up that income and happiness. Sometimes I make trades that are more favorable just for the sake of the AI depending on that trade deal. NEVER forward settle if you want peace. And play your religion game really carefully. If they have no religion, then make sure the majority of the cities have yours. If they have a weak one. Be particularly careful but again try to make the majority of cities your religion. If they have a strong religion or an older religion. Then don't send one missionary in their direction. Odds are the religious war won't be worth it. Let there religion live on but surround their empire with cities that devoutly follows yours so that it won't spread too far