That’s not how it works though. It literally is doing what it’s meant to do. If you use iCloud sync it does everything on the device unless you toggle certain things off so that it won’t. Your Apple device was never meant to have multiple iCloud accounts data on one device (or multiple devices owned and primarily used by one person having other people iCloud accounts on it also) so no, it doesn’t look at “oh, this user added a second iCloud. We won’t sync that data even though they do want to have access to all of that data from the other account”. It’s not a bug or error on Apple’s end. You’re wanting to do something that is not within the true function of the system. Ideally, the ability to add other iCloud accounts was intended for other accounts that actually belong to you so when syncing you actually want the data to update across all devices using the same iCloud(s) being used. In my case, my iPad has a separate iCloud account than my iPhone. Both are mine. Both accounts are on both devices. Both sync the data that I want shared across each other and what I don’t want shared I have toggled off in settings as I should.
Unfortunately, because you and your wife want to have each others iCloud on your devices your situation is no different except you have to decide if you want to continue sharing (and syncing and of course understanding that any time you make changes it will happen on the others device also as it’s designed to do). You said you know how iCloud Sync works so all of this should be understood….and that means you know why what you and your wife is experiencing is happening. Your issue is actually resolved because you know why things are happening as they are. You know that as it stands you will need to choose an alternative way to keep tabs on each others contacts if that is something that is important for you both to continue to do and not continue to cause changes on each others devices. You have options…ones that can indeed keep whatever changes you both make in contacts instant on your devices. But it would need to be something other than using iCloud accounts on each other devices and using iCloud sync. If you look into those options (like Google contacts you can import your contacts from your iCloud contacts without manually doing them one by one to set up….have your wife do the same and have both Google accounts logged in on both of your devices. This eliminates your iCloud data being changed unintentionally on each others devices because you wouldn’t need to have each others iCloud accounts on your devices causing the sync issue. You can check for other options if Google isn’t one you want to use of course).
Or…since you clearly know each others iCloud passwords you could simply opt to log into it via browser instead of syncing. Then if either of you has a contact you don’t have you can add it to your own. Or if one of you updates/adds a contact a simple text to each other communicating the information or even Airdropping the new/updated contact is an option. No matter what, as it stands you both are going to have to either continue to deal with the consequences of choosing to sync on each others devices or pick a solution that allows you have the constant access to each others data that you both want without the issues of it affecting your own iCloud setup.