Some OSses have an API to get some introspection about processes. Think SUNs Dtrace, or HPs Glance. I guess one could even consider /proc to be an API to get some introspection.
But I don't know of an OS that allows querying for aliases.
Comment on Re^3: Gathering current ksh shell aliases in perl