There is no inconsistency at all here

First the countif is evaluated and of course returns 0
Then your formula checks if 0=0 which is TRUE

Try the formula auditing to see the formula at work

EDIT : remove the "=0" part, and all will be well