Fix/on the fly version create

Backport to 3.x of: https://github.com/opf/openproject/pull/1030

See: https://www.openproject.org/work_packages/8223