This is actually not a bug, it is working as intended. It is not optimal, but to save the names of all of your pets (read: all of everyone’s pets) would require another large name database that ANet did not create. Currently the pet name feature saves the name in the slot, not the pet, so changing out the pet type resets the slot name.
Perhaps someday they will change this, but it is not a bug.
This is pretty much exactly what’s going on.
Tl;dr: we may change this some day, but it’s not going to happen in the near future, and it’s not a bug.
Suggestion to this: Make pet name data on user end.