By the time the government created a financial stimulus package, we had been in a recession for more than a year.
By the time the government created a financial stimulus package, we were in a recession for more than a year.
The past perfect tense (had been) is required to describe a past action completed by the time of another past action (created).