Fix docstring templates not being filled (#24535)
- [x] closes #24535
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Fixes the docstring template issue
