[1.6.x] Further hardening. Refs #18766.

Backport of c687bf0 from master.