what's the reason for hashing our public key for use in P2PKH?
There is no link to ECDSA, besides that a priv key generates a pub key. But in the transaction, you would see the signature and the pubkey. So here we are talking more privacy (not ECDSA security). If a tx appears with a "pay to public key", then the tx spending script looks like this:
ScriptPubKey= <Public Key> OP_CHECKSIG
whereas P2PKH uses this:
ScriptPubKey= OP_DUP OP_HASH160 <Public KeyHash> OP_EQUAL OP_CHECKSIG
ScriptSig= <Signature><Public Key>
In the first example you can see the used public key when the transaction is generated (in the ScriptPubKey field). Miners would use such type of tx alot. In the P2PKH tx you see the pubkey only when it is spent.
Also note the difference on the spending condition, adding a layer of security. The stack executes the script of the ScriptPubKey, by copying (
OP_DUP) the last item on the stack (
<Public Key>). This public key is then hashed (
OP_HASH160), and checked (
OP_EQUAL). This means, when you want to spend this transaction, you have to show, that you can convert your public key (in the ScriptSig) to the same hash, as the sender put as reference in the tx (the pubkey hash). As hashes are a one way function, this is not reversible, and you cannot "steal" transactions. Imagine ECDSA was somehow broken, then hashing is not yet broken... You might be able to sign a tx, but you would still have to provide the correct hash. That is as per today's knowledge impossible. Though with broken ECDSA all other weird things might happen...