No it wasn’t a trap because the first thing that the President said after the 2006 election when the Dems were put in charge was the fact we could now get the immigration bill passed.
Better question would be to ask why our pro-border security/anti-illegal immigration/amnesty candidates were challenged by the WH candidates and what happened to the DC funding when the anti-illegal/amnesty candidates won.
Money flowed to your race if you were pro-amnesty and money was withheld if you were anti-amnesty in a lot of races.
Based upon Bush’s prior messages vis a vis amnesty (stated) and lack of border control (obvious), the Democrats (along with corrupt RINO's like McCain) thus seized a rare opportunity to pass legislation which would be sure to grow both government and Democrat voter rolls, at the expense of Republican party power, whose base, enraged, would punish the Republican “leadership” in 2008 in manner similar to that which they employed in 1992 (this involving another sellout Bush).
This time, if not for an unusually engaged Conservative base, they almost pulled it off.