Why can’t pilots drink alcohol after a flight?

Commercial pilots (in the United States) are usually not allowed to drink while on duty regardless of their flight status because, among other things, it would be frightening to any prospective passengers who might see them drinking. For example, American Airlines strictly forbids consuming alcohol or any intoxicant publicly while in uniform. Here is the exact text of their company policy:

Rule 25

Unauthorized possession or using any intoxicants on Company premises at any time, or drinking intoxicants in public while wearing a uniform with Company emblem or insignia is prohibited.

Note that this does not disallow drinking as long as it is (1) not on company premises, and (2) is in private. Obviously, if the person is a US crewmember then they must adhere to FAA rules in addition to company rules (see FAR Section 91.17 for details on those rules).