There is even a more simple solution than limiting how you can sell minions or whether they dissappear after you've sold them -
When the game client checks to see if you have 2 of the minion in question, its looking at whether you have 2 minion of each different tier (I through IV). This is what allows you to have 18 minions active at once.
If it lumped each tier into a single archetype, the client could check if you have 2 of ANY level active. If yes and they're of a higher level, don't allow the summon. If yes and they're a lower level, simply despawn the current active minions and allow you to resummon your higher tier minion. This puts a hard cap on 6 minions.
I realize thats not the most clear of explanations, let me go into a little more depth here for those who care:
Currently you can summon all 4 levels of minions from each idol because they are flagged independently. IE - everytime the client checks if you have your 2 minions of a particular archetype up it looks at is as "Does player have 2 Monk I's active? If(true) cancel summon, If(false) - cast spell.
If each minion were classified together as a single unit instead of a unique unit per level, when the client checks if you have Priests active, it shouldn't matter what level you have active, it should know whether you have 2 up at all.
From a logic perspective this is probably the "correct" fix, although I obviously have no idea how deep the tentacles of a change like this might creep. Its not always as easy to fix as it sounds.
This fix allows you to buy/sell and upgrade, and also allows you to buy/summon/sell as well so it doesn't break anybodies preferred playing style. Unless of course you rely on toting around 18 minions with you at all times which I'm fairly certain is not what they were intended for.