Detection of __salt__ in loader

This resolves #10275. Please see that issue for a thorough discussion of the problem.

It appears that there was an issue where in, __salt__ defined outside
of a function in a custom grain would be overwritten by the loader
when the grain was loaded.

The old logic overwrote __salt__ if it was not present in the pack,
regardless of whether or not it was an attribute of the module being
evaluated. I don't believe this is what was intended but there's
certainly a case I could be missing.

Should probably let tests run here before merging.