strings: type assert in the generic `nextind`, `prevind` methods (#57608)
The type assertions are valid according to the doc strings of these
functions in the case of `AbstractString`.
Should prevent some invalidation on loading user code.
Fixes #57605