Optimizing the pet is a losing move. Pets have 1+9/16 BAB and 3/4 is considered dubious for a primary combatant (it's what the core rogue fails at everything with). The hunter himself is also sitting at unaugmented 3/4 BAB and doesn't have the advantage of being a natural attacker. Teamwork feats don't do a good job of picking up the slack. Some can situationally, but they're not like an ability you can just choose to activate.
Your pet is going to be weak except as a mount in the long run unless a scaling no added cost accuracy boost like inspire courage or raging song is in effect. It's great for the first few levels unless it's at level-3 or restricted to a list with nothing good on it, but as you get into the double digit levels it gets less useful.
An animal domain evangelist cleric needs boon companion, but has the properly scaling attack booster the hunter lacks. It might be worth having a weak domain, but it's not a trade I'd take myself. Then again I wouldn't take the domain trade on a druid either because druids don't need a pet to be good and domains can give options not otherwise available.
For the low to mid levels a druid pet is good enough and the hunter pays through the nose for a minor boost. The druid both fights and casts substantially better. By the time the druid's pet is obsolete the casting gap has widened and wildshape has matured. The Hunter's pet is relevant for a few more levels, but is still going to lose its purpose by the time most APs conclude. If you're playing that one that ends at level 12 hunter looks a little better, though.