Spirituality doesn’t just motivate you to help others, it motivates you to do lots of things. It’s not the only thing that can motivate you, but it’s one of the more powerful ones.
Don’t let modern life fool you, for a long long time, religious society was the only kind of society you could live in. Separation of church and state just hadn’t been invented yet.