And what happens once they are changed back?
I think the sections you linked to present the answer to your question:
Familiars: "Only a normal, unmodified animal may become a familiar." Animal Companion: "A (...) druid’s companion is completely typical for its kind except as noted below."
A polymorphed animal cannot be considered either "normal, unmodified" or "typical for its kind": It is a temporarily altered creature. Though the spell's duration is permanent, the subject retains something of its original form and the spell can be reversed by other, more powerful spells or effects, which together make the changed subject an abnormal, modified and untypical creature of its kind.
On the other hand, the idea sounds fun, and you, as a GM, are in the position to alter the rules as you wish (as long as that doesn't drive your players away, obviously ;)) - however, if you introduce something like this, the answer to the subject's fate after being changed back is also up to you to invent.
It's possible to place a Baleful Polymorph in the distant past of a Familiar or Druid Companion's, maybe as a back-story.
The baleful polymorph spell results in a creature which cannot be normally distinguished from other average members of its species, and, for the spells to be able to know that the now normal creature has a spotty past, they would have to be powerful indeed. As a DM, it would be hard for me to justify a low level spell with ability to detect this high a level of trickery. I have in the past treated the Familiar spell used in these kinds of situations as a specialized form of the Charm Person spell.
That said, if the baleful polymorph spell were to be somehow cancelled or reversed, the effects of the Familiar spell, or the Druid Companionship, will end. In a similar manner to which the power for a low level spell isn't high enough to justify checking all of a creature's past, it's also not high enough to justify the spell continuing to have its effects once the past does become obvious.
I like this interpretation because it allows me, as the DM, to perform many more tricks on the players than they can when trying to take advantage of the rules - the big baddy can trap one of the players and make him his pet, for example, or insert one of his minions into the group as a familiar, only to revert the spell at a critical time to help weaken one of the spell casters.
The intent of the rules suggest that there is no way to have anything other than a mundane beast as a familiar.
The easiest way is with a combination of Item Familiar and Polymorph-any-objecting yourself into a sandwich (or functional equivalent) (While the link to "Improving a sandwich" is dead and gone, this at least summarizes the process). Polymorph any object, depending on which version of the polymorph rules you use, is quite capable of, eventually, turning a person into a mundane beast (or sandwich) appropriate for familiarizing.
However, judging from the list of fixes here, Polymorph is perfectly capable of turning you into a mundane animal for a time, as it is possible to awaken after a polymorph (for depressing amounts of cheese, really.)
This understanding of course, does not discount the other familiar feats which provide for dragons or magical beasts as familiars.
Thus, while it is probably against the spirit of the rules, polymorph any object should be sufficient to turn a person into an animal of such quality that it can be made into a familiar or animal companion.
As with all polymorph questions, the ultimate implications of this series of actions is left to the decisions of the DM, as there are multiple sets of conflicting polymorph rules and rollbacks.
I have allowed this if the character also had leadership since thats actually whats happening, you have a poly-morphed cohort thats also your familiar. Can make for some great role playing.
You need to consider where the Familiar ability involves SUMMONING a familiar or MAKING a Familiar. The former you spend your 100 GP and 24 hours, focus on the type of familiar you want and it will come to you. The latter is the same as former except it assume that you have the creature in front of you and the ritual turns it into your familiar.
The rules do not state clearly which is the case but give the past history of the spell/ability I would say most referee use the former interpretation (summon) than the latter.
If you use the summon interpretation then the answer to your questions is no. You can control the type of creature that summoned but that it. If you interpret it as making then the answer is possibly yes as you have a target for the ritual. As OpaCitiZen points out the rule includes the proviso "Only a normal, unmodified animal may become a familiar.". So your next hurdle is to decide whether an animal that is the result of a polymorph is a normal, unmodified animal.
I would have to say no that it is a normal animal because even with a Baleful Polymorph the polymorphed character would retain his intelligence and thus not be a normal animal. However if the character was polymorphed so that in all respects to be indistinguishable in behavior and characteristics from a normal animal then yes it could be the subject of a targeted familiar.