While Hamilton could have kept membership secret it seems to be totally incompatible with his character to do so. It would be completely in character for a sneak like Jefferson to do that but not Hamilton.
He was forthright to a fault and could have avoided many a constroversy and enemy had he not been so. But he never tried to avoid or run away from a fight.
Though religious he was not a member of any congregation so there would have been no religious reason to hide membership. He was not Catholic which some allege would have prevented membership.
There appears to be no reason for such secrecy.
On the other hand, I know some Masons who have great difficulty with ritual and form but exemplify the ideals and tenets of Freemasonry in their lives to a very high degree.
I suppose the same would hold true for religion(s).