Pay to Public Key Hash has existed for the entirety of Bitcoin's life. P2PKH addresses have existed since the earliest release of Bitcoin. Creating P2PKH addresses and sending to P2PKH addresses was possible to do with Bitcoin 0.1.0.
However these early versions of Bitcoin also supported a Pay to IP address feature where your wallet would contact the wallet at a given IP address and request a scriptPubKey to send to. The response would be a P2PK scriptPubKey and thus you would create P2PK outputs.
Blocks too were mined to P2PK outputs, and in fact, Bitcoin Core still does this. Bitcoin Core's internal miner (which is only used for regtest and testnet now), still creates P2PK outputs instead of P2PKH outputs.
Pay to IP eventually began being phased out in Bitcoin 0.3.13 when its usage was hidden behind a command line switch -allowreceivebyip
in commit 172f0060
(note the author is Satoshi, however he appears to have also incorporated code from someone else). The ability to send to IP was removed in Bitcoin 0.5.0 with the last remnants of the networking code related to Pay to IP removed in Bitcoin 0.8.0.
It was known before Pay to IP's removal that it was insecure. Since the only other way to transact was via addresses, P2PKH was already widely in use with P2PK never seeming to get much use as it was only use for Pay to IP and for blocks created by the Bitcoin client.
Once external mining software came about, blocks began using P2PKH instead of P2PK because it was easier to enter an address from your wallet into an external miner than it was to get a pubkey and enter it. People were also accustomed to using addresses at that point, and addresses only work for P2PKH outputs.