I've mixed up two tabs here, and erroneously posted the solution for 12.2.5 in here. It's possible that it will work, however: https://apple.stackexchange.com/a/446578/177613
Can't post comments on askdifferent, sorry.
As per Alper's request, the basic rundown is that (on Monterey) you need to
- disable authenticated-root (and probably SIP) in recovery mode,
- identify and mount the volume with
sudo mount -o nobrowse -t apfs /dev/diskXsY ~/YOURMOUNTFOLDER
(replacing diskXsY according to your config)
- apply your changes inside
~/YOURMOUNTFOLDER
- and afterwards create a snapshot and mark it for boot with
sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs_systemsnapshot -v ~/YOURMOUNTFOLDER -s "YOURSNAPSHOTNAME"
and sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs_systemsnapshot -v ~/YOURMOUNTFOLDER -r "YOURSNAPSHOTNAME"
It looks like this will keep you from enabling filevault.