Unfortunately, it seems this is a known problem in SageTeX. See this TeX.SX question, among others. The answer to this by the author of SageTeX on a Sage group is not that encouraging since it's a TeX limitation, but there are some potential workarounds that don't involved \newcommand in that thread.