It's certainly possible to do this with your existing layout and without helper columns. Assume first table in A1:B4
and second table in D1:E3
and you can get the number of snakes Bob owns with this formula
=SUMPRODUCT((A1:A4="Bob")*ISNUMBER(MATCH(B1:B4,INDEX(D2:E3,0, MATCH("snake",D1:E1,0)),0)))
The first criterion is self-evident, I think.
For the second this part finds all the snake names:
INDEX(D2:E3,0,MATCH("snake",D1:E1,0))
....because it matches "snake" against the headers in D1:E1 and the returns the whole of the column below [by using zero as the row argument in INDEX you get the whole column].
Then, having all the snake names you can use MATCH to match B1:B4 against those. If there's a match you get a number, if not you get #N/A so you wrap the MATCH function in ISNUMBER to return TRUE/FALSE.
Another way is to use COUNTIF in place of ISNUMBER/MATCH
=SUMPRODUCT((A1:A4="Bob")*(COUNTIF(INDEX(D2:E3,0, MATCH("snake",D1:E1,0)),B1:B4)>0))