`AnnotatedString`: add concrete type asserts to `isvalid`, `ncodeunits` (#57607)
The type assertions are valid according to the doc strings of these two
functions in the case of `AbstractString`.
Should prevent some invalidation on loading user code.
Fixes #57606