You didn't do that. Your post have said that you didn't even suspect an illusion till you got a chance to roll a disbelief check. And then when you failed you decide it was an illusion and wanted to cast Detect magic.
THAT'S METAGAMING!
You're only casting detect magic because you failed a saving throw against an illusion. Your hunch was a dice hitting the table. Nothing about that is in character.
I agree with this. There were plenty of other rationales to choose to cast detect magic - believing that the body was illusory was not one of them, and was in fact metagaming.
UNLESS. Unless the character previously (through having failed a will save against an illusion to later find that it had, in fact, been an illusion) had started questioning the reality of anything seeming too inconvenient to the party, or too convenient to the party. "That door just locked as it slammed shut. Awfully inconvenient. It seems real, but I have seen illusions so perfectly crafted everything about them seems real. Try your detection spell!", "A bridge, here, miles from civilization crossing a 1000 foot deep chasm? Too convenient! It might be an illusion, cast your detection spell."
Failing a will save means "you do not notice anything is amiss". But as experience tells you (the character) that something tasting, looking, smelling, feeling, and sounding real may not be enough to determine that something is, in fact, real. Only magic can reveal magic! However, you can't just start with this from out-of-character knowledge. And to avoid accusations of metagaming you should gradually work this paranoid streak into your character. It would likely lead to mass making/purchasing of wands of detect magic, so that everything important could be examined for illusions. Including fellow party members if they ever slip out of sight for even a second.
Of course we do not know whether the phrasing in the OP was verbatim. If the character said, "I do not think this is the real body." *fails will save* "There may be some trickery about it. Is it something changed to look like the vampire? Where did the Kama go, has it been hidden invisibly? Made small? Cast your detection spell to see if there's anything screwy going on." it was not metagaming. From the phrasing in the OP however, it seems like the detect magic question *was* metagaming, but stopping all investigation was definitely over the top for the failed save.