What you fail to understand about the legal system is that written law doesn't really matter. Precedent doesn't really matter, and your precious perfect logic doesn't matter.
The only thing that matters is what a judge thinks (or can be assumed to think, without contest) about a particular situation at a particular time. Everything else serves only to influence how the judge decides. Legal precedent gives the judge a background of similar decisions to compare against, written laws provide a basis for how legislators (and by representation, the society at large) think the decision should go, and logic (as presented by the lawyers in the court) is simply a means to convince the judge which of the conflicting opinions really best fits the situation.
For this particular case, the judge has decided that it's reasonable to consider the chimpanzees to be legally-recognized entities, because that allows for the most reasonable context in which to consider the remainder of the case. Issues like marriage, taxation, and voting rights are all matters for another case, to be decided if or when such a dispute reaches a court. Having a legal decision "in a vacuum" is not actually a problem.