[BUG] Throw ClassCastException


- JanusGraph Version: 0.6.2
- Operating system: macOS 13.2.1
- API/Driver: Java

I first randomly create a graph. Then when I run the following query: `g.V().or(__.outE('el0')).as('x').V().order().by(desc).where(within('x'))` is thrown with an exception. I think this query is syntactically correct, but I keep triggering this kind of problem. I follow the rule here to generate the query: https://stackoverflow.com/questions/48067834/gremlin-intersection-operation.

### Expected behavior:
No exception should be expected to throw. Or futher messages or prompts should be thrown.

### Actual behavior:
A `java.util.concurrent.ExecutionException` is thrown. And I'm not really sure whether this problem should happen so I report this. I think it should support the type transition rules.
JanusGraph exception :
java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: org.janusgraph.graphdb.vertices.CacheVertex cannot be cast to java.util.Collection