Take your pick ... 1. Trelane was a collector of rare oddities – like a stuffed specimen of the extinct M-113 creature. 2. It's a television show where the producers liked to reuse props and costumes.
In the first draft of the script, Trelane mentions that he experimented with it, sexually, for a time. Joe, noted Trek historian
Here's my "in universe" guess, this was one of Trelane's previous "pets", and it was probably the only other M113 creature (besides the one we saw in "The Man Trap" ) and of the opposite gender, thereby dooming the species to extinction?
Don't mind Joe. He's harmless so long as you avoid wearing open-toed shoes and jodphurs too close to his enclosure. And talkin' 'bout sex: I always figured the Peppa Monster and the DJ Spinderella Monster were in other alcoves.