I would argue that the premise of your question is slightly flawed. Rashi doesn't say that God was forced to do anything. What he says is that God knew that he would decree a punishment of a year per day (אלא שגלוי לפני הקב"ה שיגזור עליהם יום לשנה) and thus he shortened their travel time to 40 days. God wasn't forced to make the punishment a year for a day; theoretically it is conceivable that He could have made the punishment a day for a day, a week for a day, a month for a day, a decade for a day, etc. But — for whatever reason — God had decided that a year for a day would be the correct punishment. Therefore, He shortened the travel time so that the punishment should not exceed 40 years.
So essentially there need not be any answer to this question, because we can simply reject the question as being invalid. God had simply decided that the correct punishment would be a year for a day, and as the prophet said (Isaiah 55:8-9):
For my thoughts are not your thoughts, nor are your ways my ways, says the Lord. For as the heavens are higher than the earth, so are my ways higher than your ways, and my thoughts than your thoughts. (Soncino translation)
Indeed, the Talmud states explicitly that the appropriate punishment was a year for a day, because God considers one day of sin as akin to a full year of sin:
Chagigah 5b
נפק ר' יוחנן לבי מדרשא ודרש ואותי יום יום ידרשון ודעת דרכי יחפצון וכי ביום דורשין אותו ובלילה אין דורשין אותו אלא לומר לך כל העוסק בתורה אפי' יום אחד בשנה מעלה עליו הכתוב כאילו עסק כל השנה כולה וכן במדת פורענות דכתיב במספר הימים אשר תרתם את הארץ וכי ארבעים שנה חטאו והלא ארבעים יום חטאו אלא לומר לך כל העובר עבירה אפי' יום אחד בשנה מעלה עליו הכתוב כאילו עבר כל השנה כולה
R. Johanan then went forth to the
College and delivered the [following] exposition: Yet they seek Me day by day, and delight to know
My ways. Do they then seek Him by day, and do not seek Him by might? It comes to tell you.
therefore, that whoever studies the Torah even one day in the year, Scripture accounts it to him as
though he had studied the whole year through. And similarly in the case of punishment, for it is
written: After the number of the days in which you spied out the land. Did they then sin forty
years? Was it not forty days that they sinned? It must come to teach you, therefore, that whoever
commits transgression even one day in the year, Scripture accounts it to him as though he had
transgressed the whole year through. (Soncino translation, my emphasis)
Once again, it is simply a statement of fact that one day of sin is viewed by God as a full year of sin, for whatever the reason may be. But, that being the case, in order to have the punishment be precisely 40 years it was necessary to expedite the journey to precisely 40 days.