How to associate dynamic PHP page for chosen WordPress tag?

Well, ideally you would want to have the data contained within the WordPress database as you then have access to the framework for data manipulation and your data is stored in a relational way in terms of the normal WordPress structure.

Custom post types for the pets and custom taxonomies for those post types would make sense. You could then create dynamic templates for each structure.

Why do you want to use WordPress’s tag structure for the pages if you do not use wordpress for the pages or info?

To take a stab at answering your question though, I would create custom taxonomy, lets say Animals, and make a WP page template within the theme for your post type and dynamic content:

category-animals.php 

and register your animals as children and their names as grandchildren.

Since you are not saving the data within WordPress, you would have to provide some structure on the WP side for this to work, even if your data is generated from an external db.

The above will definitely let WP know:

How to tell WordPress that page: mydomain.com/pets/cats/joe/ should be related to tags ‘joe’ and ‘cat’ and page: mydomain.com/pets/dogs/john/ should be related to tags ‘john’ and ‘dog’

but WordPress will still not have a clue about the data you present to the user.

I have not tested this as the use case is slightly strange but if your php code is with the custom category template, it should work

If you could explain what the reasoning is for keeping your data and structure outside of WordPress that might help?