[core] Check if running with root privileges

* If running as root, print an error message and exit. This check will
not work on Windows.