Dropping this restriction seems to work fine (there are no assertion failures), but I'm not sure whether this is guarding against some kind of silent CG corruption.
If doing this is still problematic, then the place to address it would probably be https://github.com/llvm/llvm-project/blob/8f5bdaf481c3f4e6876a5ae0e4d7c6ed2042e6a6/llvm/lib/Transforms/IPO/Attributor.cpp#L1856-L1859, which already prevents replacement outside the SCC, so I'm not quite sure what this check is intended to avoid.