(Note: I'm a Linux guy and I have no experience with macOS. Take my answer with a grain of salt).
sudo chmod 664 /etc/ you removed execute bit from the directory and in effect you cannot access (read, write) items living within. This includes (among others):
/etc/profile, where common
PS1 is defined,
/etc/timezone or whatever macOS uses.
sudo chmod 755 /etc to revert this. Unfortunately no access to
/etc/sudoers will probably prevent you from doing this directly. If you're extremely lucky, you still have a shell running as root (started for whatever reason before things went wrong) where you can invoke
chmod 755 /etc without
sudo. But probably you're not so lucky.
If the same problem occurred in my Kubuntu (no encryption or such), I would boot live USB Linux, mount the filesystem and fix the permissions. I don't know if you can easily fix macOS "from the outside" like this.
This (oldish) question deals with a similar problem where
sudo doesn't work because of wrong permissions of
/etc/sudoers. Possible solutions from answers:
This may be one of the rare cases where running "Repair Disk Permissions" from Disk Utility might actually be warranted.
If that doesn't work, follow […] suggestion of booting into single user mode to fix it
This one looks promising:
Another approach is using
Create a new workflow that contains something like the following:
do shell script "chmod 0440 /etc/sudoers" with administrator privileges
When you run it, it'll ask for your password and (presuming you're an administrator) it'll fix it.
This also works if you've messed up the permissions on a parent directory (eg making
/ something other than 755).
Keep in mind you need to
chmod 755 /etc, so don't blindly paste the above code. Your case falls under "messed up permissions on a parent directory".