This might sound like a conspiracy theory, but here goes. You're right, they had plenty of opportunity to pass funding for the wall, so why didn't they? What if they did it on purpose?
If you know that you're going to lose the House, you focus on maintaining control of the Senate. Which means you're going to have a divided Congress, and a government shutdown is almost a guarantee. The only question is what issue will the shutdown be about? If you're the Republican leadership, what battleground would you choose? A Republican issue like the wall that you believe (rightly or wrongly) that you have support for, or a Democrat issue, say like healthcare, that you're almost sure to lose?
Again, this presupposes a lot of forethought, and might enter the realm of conspiracy theory. At the same time, isn't it just as foolish to assume that professional politicans on both sides do not engage in any forethought and contingency planning?