You can't. If I choose "At the beginning," not only must you have cast guidance prior to the check, but later castings are useless. It doesn't matter how long the task takes, the check is over and can no longer be modified. You can only roll for guidance after the roll if the spell is already active.
Your argument allows you to get an infinitely high number as you can just keep casting it forever, even long after the check has been rolled, and long after the activity is over. This is clearly not the case. If the spell is active, you can trigger it as soon as the roll happens. If no spell is active, by the time the caster casts guidance, it's too late to affect the roll. The ability check has been decided.