SERVER-11300 Fix cycle detection in role management commands