There is a metaphysical truth that, at the very least, other people ARE you, so how you are treating them you are treating yourself directly. But I think this leaves open room for error because there are some other parts to this that you may not realize.
First of all, you can only share love. Love IS sharing. It means joining and communing and being equal and being ONE. This is the underlying truth on which this idea is based. You CAN only share love. So this really means, you CAN only "do love" to others, you cannot actually really do anything else to others.
So when it comes to "how should I treat other people", the ONLY option that you can REALLY pursue is to love them. Love will be extended and shared to and with them. If your attitude is NOT love, IT WILL NOT BE SHARED.
So that means you CANNOT do unto others anything other than love.
There is also more to this.
Your mind, when you are believing that YOU are sinful, will become a split mind. It's a mind that believes separation has really happened. And this separation has happened INSIDE YOURSELF. Your own mind has become split. Part of this split will entail that a portion of mind remain in your awareness - conscious awareness - and a portion will be sectioned off and repressed as a place to shove your unconscious guilt. But the splitting off of that second part of mind (which produces a shadow, at war with your conscious persona), is now experienced as "not myself"
And so then you are in a state of disassociation from your whole self. The part of YOU that you think is not you, which you are trying to get rid of like crazy, you will believe you are separate from it - that it's not you. And so when some person comes along you will see them as "not you" also, and will then see IN them your own "not you" part of your own mind. You will relate to your own "not you" mind as though it belongs them them, since it doesn't belong to you. And you will attack that part.
So now you think you are "doing ego" to someone else. That you are treating them with less than love. And that means it now seems optional as to how you treat others. But really you are not even doing anything to them at all. If they were awake they'd know this. You are just attacking your own self indirectly. So you're not ACTUALLY doing anything to others, if it's coming from your ego. You literally ARE only attacking yourself.
So now we have this situation.... either you love both yourself and others, or you go into a private world where you are attacking yourself, but believing everyone else is involved. Nobody else is involved AT ALL.
Thus it's not really a case of having to then figure out how to "do unto others" in a better way. You're NOT doing unto others. The only thing you CAN share with them is LOVE. If you are not in love with yourself, you will do nothing "to" them at all, because unlove is a WITHDRAWAL from sharing.
So now we shift from trying to "do unto others as you'd have them do unto you", to something more like "do unto YOURSELF as you would have YOUR TRUE SELF do unto YOU."
Translated, that means learning to undo your own belief that YOU are sinful, which will result in you becoming aware that you LOVE yourself. You WILL then be able to extend this love to others. So learn to do unto yourself what GOD would do unto you, which is to recognize you are worthy, forgiven and innocent forever. That should be your aim, and don't be so concerned that you even CAN do anything to anyone else.
It's not because of some kind of guilt-ridden ambition to be nice to other people that you're doing this. Since you can't do unto others unless it IS love, you can forget about believing that you're mistreating people. You are only capable of mistreating yourself.