Simple solution. Anyone who attacks a solder should be expelled from their yeshiva, and any yeshiva that fails to expel such a person should have all of their government funding cut until they do so. Once expelled, the attacker will have no basis for an exemption and will be drafted.
Pope Francis: Divorced Catholics who remarry and their children deserve better treatment (AP)
from the article: Religious IDF soldier attacked by ultra-Orthodox rioters in Jerusalem