This is, as you rightly suggest, an issue of campaign design as well as of player management. The campaign design aspects come in at a surprisingly foundational level, in my opinion: What is the distribution of physically powerful NPCs and institutions in your world? If they are plentiful, the question becomes, "Why does this campaign world need the PC heroes in the first place?" If they are sparse, how are the powerful PCs kept in place (and indeed, why have their counterparts not simply taken over the game world?)
Once you start to have a handle on these basic questions, you can start to think through methods of control. I can't tell for certain, but your game world sounds as though it might be on the sparse end, and that is my comfort zone as well. One framework I have seen used to devastatingly good effect for sparse populations of powerful PCs/NPCs is a system of patronage, which has three broad levels of retaliation/control.
It works like this:
In such a setting, stipulate that generally one is not born being the sort of person who can casually and effectively murder their way out of every situation. They were probably taught such skills by someone, for a purpose. These people, or organizations, or institutions, may very well act as gatekeepers for further advances-- houserule it, if you must. They may also act as gatekeepers for other vital resources, as well: Not just leveling up, but information, magical commodities, writs of authority, even entry into cities or home bases and so forth.
They are patrons. They may be different for each PC, even. There is every reason to imagine that the rogue's patron is not the same as the cleric's patron. If they are rare, presumably, they are also busy, thus explaining why they need the PCs, but what they do not need is the PCs embarrassing them.
The first stage of a patron exerting control, aside from a pointed verbal warning, is passively shutting down access to those resources. Oh, your loot is fetching silvers on the gold for what it's worth? Maybe there's a reason for that. And yes, there's a TERRIBLE shortage of healing potions. No, those are already reserved for someone else. Someone who isn't you.
The second stage is more pointed: Even if the population of powerful people is sparse, that doesn't mean the PCs are the only ones. Surely they have rivals trying to advance in their patrons' good graces.
And the final stage (by which time the campaign is probably broken, so don't let it go this far) is for a patron to decide that the time has come to get their hands dirty. This should be something the players are made to fear, not necessarily through direct displays of power, but possibly also by tales of what happened the last time someone stepped that seriously out of line. It doesn't even have to be ghastly if the patrons aren't evil, just effective.
If your players are not bound and determined to role-play sociopathic murderhobos (i.e., if they're just generally thoughtless, not actively wicked) you should be able to get your point across. Just make sure not to be too cryptic-- if your players are scratching their heads, you are not being clear enough and are not helping the situation. And make it clear that reconciliation in the early stages is possible and desirable-- if they feel they've crossed a permanent line into outlawry you are also not helping yourself.
If you are consistent, you should be able to get them to keep thinking in terms of ramifications and social behavior long after you've moved out of the ramification phase. At which point, it can be fun to have them face down a similar problem from the other side-- a similar junior NPC might be causing problems and the PCs are sent to deal with it gracefully. Or perhaps it's their own junior NPC embarrassing them directly.