One cannot make the argument that “Bernie Sanders is not a Democrat” if your head would have exploded if Sanders would have run as an independent and therefore thrown the election away from the (more perceived) liberal candidate. By running as a Democrat, he did the only responsible thing that can be done in our one-vote, winner-take-all election system — he caucused with the candidates/party he was most closely aligned with so as not to dilute the vote. This is the entire purpose of political parties. To be elected as an independent does not mean one is not a Democrat or identify as one. It means that one has chosen not to seek the endorsement of the party. In the Senate Sanders caucuses with the Democrats. In the presidential election he did the same.
As for non-Democrats voting in the primaries, in my state at least, the only way to show you are a Democrat is to come and vote in the caucus or primary. There is no membership roll. By showing up, you are announcing your alignment. The “non-Democrats” who were trying to vote for Sanders in other states were trying to be Democrats, but the powers-that-be in the party would not allow it because they would loose power of what they perceived belonged to them.
Although the party is an official, legal organization, being a ‘member’ of it is as nebulous an idea as being a fan of a certain sports team. Part of that is a result of the structure of the party. But much of the problem is that our election/political system is set up in a way that only allows two teams to be able to realistically complete at the same time. To start a third team necessarily sabotages the one other team with which one is most closely aligned. By running as a Democrat, Sanders did the responsible thing and now is getting beaten up over it. But I suppose he is used to that by now.