The "Attribute" node in shader node trees could support attribute search based on the context data. The search code would be generally the same, but the data would be accessed directly from the evaluated geometry set of the active object.
Therefore attribute search should not be used when the node tree is pinned, or alternatively it could depend on the pinned object context of the node editor, if that is available.
Note that fewer attributes are available for EEVEE. There will have to be a special case there until more attribute access is implemented there.
Some starting points / references:
node_geometry_attribute_search.cc
rB85421c4fab02: Geometry Nodes: Attribute search drop-down
rBc0b2c75c441d: Geometry Nodes: store available attribute names in node ui storage
D10623: Geometry Nodes: Add domain and data type to attribute search