Fix version number generation when we want to set the patch number

Refs #8097
Merge branch 'bugfix/8097_fix_patch_number' into develop