vote: Refactor vote casting to prepare for pgvote removal.

The intent of this patch is to refactor the existing vote-casting code
into a state that's ready for pgvotes to be dropped and replaced with
reads from VoteDetailsByThing.  Ideally, no behaviour is changed by this
patch (hence "refactor") and then the later data model change will be
lower risk as a result of less code shuffling.

Once this patch is applied, the `Vote` class/rel is considered an
implementation detail of the vote module and hidden from public view.