menu_get_object() not returning node object when view's display is Entity Reference
The entityreference autocomplete paths are defined in entityreference_menu() as:


entityreference/autocomplete/single/%/%/%
entityreference/autocomplete/tags/%/%/%


The wildcard arguments are field name, entity type and bundle respectively. The entityreference_autocomplete_callback() function also accepts an optional entity id and string parameter (the last being the search string).

So while you're expecting the path to be node/[nid], it'll actually be one of the above - which explains why arg(1) is giving you the string autocomplete.

I haven't tried it but you should be able to use arg(6) to get the node ID in your current context.