It’s a clumsy paraphrase of a statement attributed to the Buddha, so it has to be understood from a Buddhist perspective.
First, remember that a key tenet of Buddhism is that what you commonly think of as your self is an illusion. We typically imagine that this self is an independent being that is fundamentally separate and different from other beings. In this way of looking at things, there’s “me” and “others”. If you take that as who you really are, then you can love yourself a lot, and still not give a shit about others.
But the Buddha taught that every single being is densely interconnected with every other being, so much so that it’s nonsensical to think in terms of “self” and “other”. The very idea of harming someone else comes from thinking that that “someone else” is not “me”. But understanding how closely linked we all are changes that basic premise. It means that I can’t love “me” and hate “you” any more than I can love my right hand, but want to harm my left.
It’s not hard to understand a statement like “If you truly loved yourself, you would never harm your left hand”. All the Buddha was pointing out is that if you understood how connected you are to all other beings, then you wouldn’t assume that you end at the boundary of your skin, and there could be no distinction between loving yourself and loving others.