Because they will be paid, eventually, for this work, once the government is funded. But since Trump said today that he's willing to keep the shutdown going for years, maybe it's time for these people to search for a paying job.
They'll make a stubborn show of defiance but in due course some deal will be struck and some defections will occur because holding the government hostage to fund a wall to keep the Mexicans out is insane. Trump may be willing to fight to the bitter end for that but I guarantee no career Republican politician is.