[TBDGen] Fix check for global accessors (#18883)
Previously, TBDGen skipped emitting lazy initializers for globals that
appeared in any file with an entry point. This breaks, however on files
that have an NSApplicationMain/UIApplicationMain class in them, where
the entry point is synthesized but top-level globals are not locally
scoped. This change re-uses SILGen's check and only skips variable
declarations that appear at top level in a script mode file.
Resolves rdar://43549749