I think you make the assumption that the person writing the test will be able to write a test that will trigger only when the same bug would happen. This could happen for some very narrow unit tests (as in the examples), but in real life there will be many tests involving multiple functions (to reproduce the same situation/code path) and then the tests can prevent other bugs.
(put it another way: if the programmer introduced a bug by mistake, probably by writing a test it will test more than wanted by mistake...)
> I think you make the assumption that the person writing the test will be able to write a test that will trigger only when the same bug would happen.
I'm aware of this, it still comes down to weighing up the costs vs benefits. It's not practical to write a test for every small behaviour of a complex app.
(put it another way: if the programmer introduced a bug by mistake, probably by writing a test it will test more than wanted by mistake...)