#22572 - Improved paths_from_template behaviour when template contains
optional keys