The full text of <SG2> is quoted here, for reference:
<SG2> Robot expansion is limited once the Match begins. As per <G3>, at the beginning of a Match, each Robot must be smaller than a volume of 18” (457.2 mm) long by 18” (457.2 mm) wide by 18” (457.2 mm) tall.
a. Once the Match begins, a Robot which is contacting the Expansion Zone may expand vertically with no height limit. However, once fully outside of the Expansion Zone (i.e. no longer contacting it), the Robot must return to a height limit of 18” (457.2 mm) tall.
b. Once the Match begins, Robots may expand, but no horizontal dimension can exceed 36” (914.4 mm) at any point during the Match.
c. As a result of this rule, Robots may not contact High Flags.
Note: A Robot which interferes with gameplay as a result of violating this rule, such as Toggling a High Flag or blocking a launched Ball while outside of the Expansion Zone, will result in a Disqualification, whether the interference is Match Affecting or not.
Minor violations of this rule that do not affect or interfere with the Match will result in a warning. Match Affecting offenses will result in a Disqualification. Teams that receive multiple warnings may also receive a Disqualification at the Head Referee's discretion.
Expanding beyond 18" tall outside of the Expansion Zone will always be a violation of <SG2>. The penalty will either be a warning or a Disqualification depending on the number of warnings received, if the Robot interferes with gameplay as a result of violating this rule, or if the violation was Match Affecting.
It is always difficult to issue blanket rulings on hypothetical Robot designs. However, any mechanism which must expand taller than 18" outside of the Expansion Zone to operate would be in violation of <SG2>. As this hypothetical mechanism is being used to Toggle Flags, it would most likely always be considered "interfering with gameplay", and would most likely always be considered Match Affecting if its use resulted in winning the Match. Thus, it would not be legal.