You're not the only one thinking this behaviour should be changed, my own feature request on Meta.SO to change this is the second-most upvoted unresolved feature request at the moment with a score of over 200.
As far as I understand from some comments from SE developers, changing this would be pretty complicated technically. Just transferring the votes to the community user would not work as no user can vote multiple times for the same post.
For reference, here is the text of my argument on Meta to change this behaviour:
Currently, when a moderator deletes a user all of the user's votes
are removed along with the user himself. I was pretty surprised at
this behaviour when I first heard about it, and I don't think it is a
good idea to throw away all of the votes just because the user is
deleted.
Votes are locked after a short while and you can't change your vote
unless the post is edited. This is a precedent that shows that users
don't have complete control over their old votes, their ability to
change or remove their votes is restricted for the benefit of the
whole site. I don't understand why users that get deleted are suddenly
exempt from this restriction.
The drawback of removing the votes is that we throw away valuable
information. Voting plays an important role on SE sites, and every
time an active user is deleted we throw away some of that information.
I also don't see why rage-quitting users get to remove one kind of
contribution (votes) while we stop them if they try to remove their
other contributions to the site (posts). We stop users from deleting
all their posts because they still provide value to the site, I don't
see why we shoud treat votes any different. They might have less value
than posts, but they are useful to the site as a whole.
I'm ignoring any vote invalidation in connection with vote fraud or
sock puppeting for the purposes of this post. Those votes should
certainly be invalidated, but that doesn't usually happen by deleting
users.
The recent change to counting reputation from deleted questions if
they are old enough and have at least three upvotes moves the whole
reputation system further into a direction where reputation can't be
taken away after some time. The reasoning for this change was that
even though certain questions are off-topic now, they used to be
on-topic and therefore the reputation earned had some meaning then.
This provides further precedent that reputation shouldn't be removed
retroactively on a large scale.