Matthew 7
It seems to me that jesus clearly wants the golden rule to be a basis for law or at least morality.
12 So in everything, do to others what you would have them do to you, for this sums up the Law and the Prophets.
https://www.biblegateway.com/passage/?search=Matthew%207&version=NIV