I believe Ryan is being rightfully vilified for his half-hearted rejection of Trump — denouncing his remarks, but not going as far as denouncing him, showing a lack of principle in two directions. But his behavior makes some (craven, political, self-interested) sense when you look at the impossible dilemma he's put in as a Republican leader trying to hold on to the GOP majority in the House of Representative.

The walls are closing in from both sides on Republican leaders. On the one hand, there are moderate Republicans who are turned off by Trump's awfulness and could reject the Republican Party as a whole for their closeness to him. On the other, there are hardcore Trump voters who propelled him to the nomination partially based on their hatred of the Republican Party establishment.

Based on Trump's response to Ryan, it's clear that he's not making things any easier:

Republicans in Congress have real reason to be fearful. If several million Trump supporters decide Trump has been betrayed by Republicans in Washington, they might vote for him in November but leave their Congressional votes blank. Trump's spokesperson, Katrina Pierson, seems to be already encouraging this:

Meanwhile, GOP leaders have to worry that Republicans who reject Trump will stay home rather than voting for down-ballot candidates.

And if Republicans face large portions of their base who either stay home rather than vote for Trump or vote Trump but refuse to support Congressional Republicans, holding on to the House majority is moving farther from possible every day.