Troops patrolled Kathmandu on Wednesday, ordering residents to stay home after two days of violent protests over a social media ban forced Nepal’s prime minister to resign, left 25 people dead, and pushed demonstrators to press the military for a transitional leader.