Issue #7792 made `x < I` different from `I < x`: fix and add tests

I noticed that #7792 makes `I < x` raise an error.  But `x < I` is unevaluated.  Here's an attempt to fix.

Also, add tests.
can other be something non-sympy (like an int or float)?  I could not make this happen...

Please advise if this other.is_real is dangerous?