I have consulted a retired Naval Captain of the HM’s Navy known to me.
Police officer can arrest anyone including the Prime Minister if found breaking the law in the area under his jurisdiction. I was given to understand that there are no legal restrictions on civilian police arresting uniformed/ serving military personnel unless it was a restricted area where police cannot enter without authorization.
However once arrested, the military personnel are obliged to inform the Commanding officer and he /she can demand full access to do so. Normal procedure would be for the service personnel to be handed over to the Military/Naval police and tried by the military themselves. I would expect that generally similar rules apply in Pakistan as well.
Since there is no respect for the law in Pakistan society and army officers/ personnel being members of the same society, also have similar attitude towards the law of the land. In my humble opinion, even if Motorway Police was totally in the wrong, Pak Army Captain should have voluntarily surrendered and taken the case up through the official military channels. Beating up of police officers in the course of their duty should not be condoned under any circumstances.