Unable to share Wi-Fi passwords with one of my Macs
I don’t have a fix, but I know this has come up. Also, this is going to be very hard to reproduce your conditions, so it might be a while to solve this. Here’s how I would troubleshoot this, based on a layered approach:

Make sure AirDrop works bilaterally - photos / web page - share back and forth.
Make sure Handoff works bilaterally - safari and messages are good to test
Make sure WiFi handoff works - this uses Handoff to store an item in Keychain / System Preferences

So, for most people, I would expect handoff is the broken piece here and not that the keychain or system preferences app are broken for you.
Also - when A/B testing, it’s very useful to have a C to test - iPhone / iPad or another Mac.
Good luck - with so many variables, you may need a piece of paper or spreadsheet to test the various apps in the various configurations, but WiFi sharing layers on top of handoff which layers on top of AirDrop with iCloud identify certificates to allow Handoff to work. Hopefully you can eliminate iCloud as a cause by signing out and in, but clearing the keychain of signing / identity certificates might be needed - especially if iCloud syncs these down to the Mac A after you erased it.