Allow specifying a custom PATH for which method

Closes #21794.
Make usage of ObserverPathnameExtension more obvious

Remove use of globals.

Closes #21795.