[1.5.x] Added sphinx substitutions in place of hardcoded version numbers.

Refs #19571

Backport of 1884868adc from master