I think the only way to recover this is to reinstall macOS and then restore your data from your most recent backup.
You are not alone in having done this - I made a similar mistake 30+ years ago on a Solaris machine, but fortunately had a full (and recent) backup to recover with. Consider it as a 'rite of passage' to being a Unix system admin and don't do it again :)
Topic:
App & System Services
SubTopic:
Core OS
Tags: