President Reagan had a sign on his desk that said, "It's amazing how much you can accomplish if you don't care who gets the credit." If President Obama had a sign, it would say, "It's amazing how much you can accomplish if you don't care what the public thinks."
Democrats, I suspect, have made a quite rational calculation about the election. It's baked in the cake that they'll lose seats, but how many more might they lose if they pass a series of unpopular bills? Maybe only a few. Given this, there's a case for going all out this year, which is exactly what they're doing.