Sounds like you have installed protobuf via Home Manager or nix-profile and/or are using the system's compiler instead of one installed through nix?
All compilers in the nix package store are wrapped in custom shell scripts that injects the needed paths the compilers are looking for in FHS directories. In case of gcc glibc and libcxx, as well as $NIX_COMPILER_FLAGS (name from the top if my head) which is populated by nix depending on what is installed. For example, if you would use a nix development shell (classic or flake based) and install protobuf there, the correct include paths the wrapped compiler needs would be contained in this variable.
Have a look at https://nixos.wiki/wiki/C which answers a few questions and look at the wrapper code of gcc (in the gcc package) which points to gcc-unwrapped.
Unfortunately with iOS you are stuck with Obsidian Sync because Syncthing does not work because of the permission model. Otherwise I prefer Obsidian over Joplin for the above mentioned reasons and nice extension ecosystem. It's easy to get your files out of Obsidian, no vendor lock-in