Take a look at the Config.Namespaces class in the %SYS namespace.
It looks like the CopyMaps method should do the job.
It is possible. You will need to override the %Get and %GetSerializedMetadata method of %SQL.CustomResultSet.
It gets a bit messy but works fine.
Certifications & Credly badges:
Timothy has no Certifications & Credly badges yet.
Global Masters badges:
Timothy has no Global Masters badges yet.
Followers:
Timothy has no followers yet.
Following:
Timothy has not followed anybody yet.
You could use the %SYS.GlobalQuery NamespaceList query instead - there is a parameter to include/exclude system globals.
s rs=##class(%ResultSet).%New()
s rs.ClassName="%SYS.GlobalQuery"
s rs.QueryName="NameSpaceList"
s sc=rs.%Execute($namespace,"*",0)