The wires to the side stand switch are a black and a blue/yellow.
The side stand relay has 4 wires, a red/white, a black/white wire, a black wire, a blue/yellow.
The black goes to ground. The black/white comes from the TCI box.
The blue/yellow wire also runs through a diode to the neutral light wire.
With the side stand down, if you put it in gear this trips the relay. When the relay trips the black/white from the TCI box gets grounded.
If the side stand is up when you put it in gear the relay won't trip.
I don't have a switch to test so I can't say if the switch is open or closed when the side stand is down. Just removing the side stand relay is the way to delete the engine stopping when put in gear.
On the charging system you need to read the charging guide. I don't know how to link to it but if you look up near the top of the page you will find the XS650 TECH button. This leads you to a list of topics. Scroll down to the Electrical, under this heading scroll to How To: Diagnose charging system problems (charging system guide)
This has the test procedures to find out what in your charging system isn't working. You may find it is a cheap fix. A bad connection, a free fix, up to the costly stator replacement. I can't recommend buying new parts until you find out what parts you need.
You say you bought new brushes and a reg/rec. It could still be a bad connection somewhere. So don't throw away the old parts they may still be good.
Do the testing to find what's bad. Then buy parts.
The red/yellow wire from the fuse should have battery voltage. This wire feeds power to the headlight on/off part of the safety relay. When the bike is running power comes up from the alternator on the yellow wire. This yellow wire trips the relay and hooks the red/yellow wire to the blue/black wire.
If your charging system is not working the yellow wire won't have any power so the relay won't trip. So the voltage on the blue/black wire will be low.
Leo