This restores the check removed in #17785 (comment) Instead of using error, which was used previously, it uses a newly introduced Assume(). error had several issues: It logs unconditionally to the debug log It doesn't abort the program when the error is hit in tests
Backport of core#20138.
Depends on D9680.
Ref T1611.