I’ve set up a self hosted photo system with immich, and it works doing automatic backups of photos from the filesystem, eg using termux/cron, although it is a bit flakey. Immich also works for backup, but it’s less ideal.
iPhone seems to be a lot harder, backup in immich doesn’t work, it seems that iPhones have a complicated was of handling background tasks which make background backups very difficult.
Does anyone know a way of doing any kind of backup automatically, without plugging in a cable and without using iCloud?
You can. It’s more straightforward in Synctrain than Mobius but both can do what the OP needs.