why not we just use one kind of address type, such as legacy p2pkh?
Because other address types serve different purposes that cannot be achieved with P2PKH.
For example multisig addresses can either provide greater security against certain types of threat or can involve multiple parties in some scheme.
Improved types like P2SH and P2WSH provide better privacy and provide for scaling the Bitcoin network - providing more capacity for transactions. This cannot be achieved using P2PKH.
if we only use the original bitcoin address format, aka. the legacy p2pkh. Is it possible to implement other formats' functions?
Because we use the word "address", people sometimes misunderstand the nature and purpose of a Bitcoin address. It is not a designator of a recipient.
An address is a recipe for a specific type of locking script, it is a complete recipe that contains all the information needed by a payer to construct a locking script that pays the recipient using a script-type specified by the recipient in the address.
If an address could be used with multiple different locking scripts, then in addition to their address, the recipient would have to provide a list of script-types acceptable to them and their wallet software. The address was intended to do the whole of this job.
This is why many people feel that "Bitcoin invoice reference" might have been a better name than "Bitcoin address".
Remember: Bitcoin addresses do not exist in the Bitcoin network protocols and are not used in the Bitcoin network. Addresses, as such, do not appear in the Bitcoin blockchain
Bitcoin addresses are a convenience but not a necessity. The Bitcoin network would work perfectly well if nobody ever used addresses but used some other method of communicating desired locking scripts in QR barcodes etc.
The reason I make this point is not because I want to get rid of addresses but because I think people will be better off to let go of some of the irrelevant semantic baggage associated with the word address from its everyday non-Bitcoin usage.