Is joining a church an example of legalism?

Yes, if it is treated as something you can do in the flesh to accomplish God's will, it is legalism.

Watch the Teaching: Is Keeping the Commandments Enough to Be Saved?