It’s a lot simpler to have a .obsignore hidden file in a top-level folder (and in any other folder) that specifies which files and folders thereon contained should be ignored. Inside there would be only relative paths to the .obsignore’s folder.
This is exactly how Syncthing is handling it.
What I would add to Syncthing’s approach is operators that specify exactly how should a particular folder or file be ignored. For example, maybe I just want to hide the folder obsolete/irrelevant/ in Obsidian’s file explorer while keeping its content available for linking and searching. Say I also need to completely hide the folder downloads, no linking, no nothing inside Obsidian.
.obsignore would then contain these lines:
obsolete/irrelevant %invisible
downloads
Or something like this.