How can I safely remove snap without breaking apparmor

The AppArmor profile is located in /etc/apparmor.d/usr.lib.snapd.snap-confine.real file, which came from snapd package.

So you should use apt purge instead apt remove (see man apt for details):

sudo apt purge snapd

Small note: for me the snippet below looks better -

snap remove $(snap list | awk '{print $1}' | egrep -v "Name|core")