There are a few classes that should be but are not `Expr`s, like `MatrixExpr` and `TensExpr`.  But this code wouldn't handle them properly anyway, so I don't object to going back to `isinstance`.