The mad-attacking is probably a response to "badboy points". This is a system in which you gain points for hostile activities, such as declaring wars, conquering territories, etcetera. (The exact number can be found in the save file, but is not visible in-game)
What happens is that the computer countries will gang up on whichever country has the most points. There's about 10 computer countries that will rack up the points - as long as you stay behind one or two of them, you're safe. These generally include (in rough order, most points to least):
Turkey, Russia, France, Spain, Sweden, England, Poland, Austria, Prussia, Denmark
The small German and Italian states sometimes also rack up the points - conquering a whole country gets you a lot more than taking territories off a larger country, and there's all those 1 and 2 provincers there. Generally at the beginning of the game Turkey and Russia go conquest-happy in the East, and France in the West. Later on the other European powers tend to conquer the smaller countries and war with one another (between the Reformation and the Edict of Tolerance). After Tolerance, you'll mainly see a number of smaller European states conquering one another, and the three or four big boys in the region meddling in Germany and Italy (usually Austria, France, Netherlands, and whoever else controls a number of territories in the area).
If you're getting ganged up on, the best response is to stop expanding and make peace as quickly as possible without giving up too much. (You don't get points for capturing territories in a war, as long as you don't keep them in the peace treaty - you can often force a status quo peace after capturing one province.) Your points will slowly decrease if you are inactive, and the chances are one of the computer countries will be out increasing theirs at the same time, and so will soon have more than you do.