See also: Blackstone's formulation: https://en.wikipedia.org/w/index.php?title=Blackstone%27s_fo...
The officer has done wrong (entering the home without the warrant) and should face some punishment for that. The threat of punishment deters the officer from acting without a warrant.
On the other hand, releasing the criminal, who is actually guilty, is not a real deterrent. What if the officer doesn't particularly care if the suspect gets arrested or not?
It's the threat of consequences to the particular individual that decide their actions - not the threat of conflicts with the purpose of their organization. Put another way, I bet fewer police officers would commit misconduct if the consequences were "you personally go to jail" as opposed to "a criminal is freed and your organization is supposed to do the opposite of that, don't you feel bad?"
Presumably there's some level of incentive to catch criminals. Otherwise why would police officers do anything? (Of course another possible answer is that they don't).
> If so, why couldn't we just keep that part and not release the criminals on the technicality?
Because it's very hard to maintain an incentive unless it's aligned all the way through an organisation. The consequences for police dishonesty needs to be something that will cause police chiefs to lose elections. Letting criminals go free is one of the few things that does that.
Also, the entire institution of police/prosecutors/courts/judges need a disincentive against misconduct not just individuals. Otherwise they can just use a revolving door of disposable/sacrificial cops to violate rights and get convictions.
Allowing convictions to stand in spite of illegal investigation methods makes rules against those methods completely meaningless for defendants.