Is God a ficticional character or is this societies way of keeping law and order in the world.
Authoritarian / fascistic / fundamentalist religion definitely is. Some other kinds do not lead with dogma and have more of a focus on community and good works.
God is fictional AND inventing gods is society's way of keeping, not so much law and order (we have legal and penal systems and other forms of social pressure for that) as just controlling people and extracting money from them. Sometimes governments leverage religion for political ends as well.