Since many support the fix, I will write in more detail what specific changes I think could be made. What is indicated below is an ambitious plan. Perhaps not everything from this should be implemented.
1. When a hero enters the tavern, the number of movement points is set according to the army they came with. This means that there will be no heroes with 2000 movement points, and conversely, there will be no heroes with fewer movement points due to "phantom" 3 stacks (for example, when a hero arrives with 1 centaur, but the number of movement points is as if he has dwarves).
2. The removal of a hero in the tavern is treated as death (mana and movement points are restored).
3. When a hero dies, their temporary modifiers are removed: visits to stables, fountains of youth, etc. Also, the number of daily damage spells used in this turn is reset.
4. Expanding the mechanism that prevents digging up a hero. Currently, heroes who died simultaneously in battle are excluded from the pool. This can be expanded to include any hero deaths. At the same time, in order for the pool not to run out, the following mechanism applies:
— Each hero who can come to the tavern is assigned a rank depending on their level, artifacts, spells, etc. The minimum rank is assigned to level 0 heroes and weakly developed heroes (conditionally up to level 5 without artifacts). The next rank is for heroes up to level 10, etc.
— When selecting heroes for the tavern, a hero with the minimum rank is always chosen. If there are no more such heroes, then a hero of the second rank is taken, and so on. This prevents the hero pool from running out. At the same time, dead main heroes or heroes with powerful artifacts receive a high rank, and their arrival in the tavern is practically impossible.
---
In single-player mode, all this should work exactly the same way. The mechanism against digging up heroes may damage games in the style of offline tournaments, where inviting a hero to the tavern is used. But I find it difficult to judge how much of a problem this is, and this format is not very popular in Heroes anyway. On the other hand, for casual play against the computer, anti-digging is a plus – powerful AI heroes will not be dug up.
---
I will also say right away that I do not think it is possible to implement resetting hero levels upon death, primarily for atmospheric reasons. The problem needs to be solved with other mechanics.
— Each hero who can come to the tavern is assigned a rank depending on their level, artifacts, spells, etc. The minimum rank is assigned to level 0 heroes and weakly developed heroes (conditionally up to level 5 without artifacts). The next rank is for heroes up to level 10, etc.
— When selecting heroes for the tavern, a hero with the minimum rank is always chosen. If there are no more such heroes, then a hero of the second rank is taken, and so on. This prevents the hero pool from running out. At the same time, dead main heroes or heroes with powerful artifacts receive a high rank, and their arrival in the tavern is practically impossible.
What if we add a chance of appearance to the ranks? For example, level 1 heroes - 85% chance of appearing, level 2 - 10%, level 3 - 5%. This way, the real possibility of digging up a hero before the entire pool of heroes is exhausted can be preserved, but at the same time, it can be made too expensive to abuse.