The Catholic Church has issued a warning to its clergy in Washington state: Any priest who complies with a new law requiring the reporting of child abuse confessions to authorities will be excommunicated.
https://www.newsweek.com/catholic-church-excommunicate-priests-following-new-us-state-law-2069039
Well you already pointed at why: because you can be ordered into mental health care. You can’t be ordered into confession, it’s completely voluntary. Furthermore, priests do not have a legal duty of care; they are not registered professionals with professional standards to follow. Their role is defined by the church, not law and regulation.
In a practical sense, such a law isn’t going to work much anyway. It would be almost impossible to prove that a priest had been confessed to, short of someone admitting it directly. So the only way it works is if the child abuser wants to get one over on their priest - giving the child abuser another avenue to hurt someone else.