Make the system message node type finding more generic

This function really can be used to match any node and
there parents to a given type.