Mew could only legally be obtained in Virtual Consoles through an event. All Mew received from such an event have an OT of "GF" and an OT ID of "22796". If a Mew does not have these values, it won't transfer.
Now if you want to obtain a Mew that passes the check, since the event is over, you will need to do either of these:
- Name yourself GF at the start of the game, randomly get assigned the ID 22796. Restart until it works. Then just catch Mew through the Mew glitch.
- Use homebrew or ingame glitches to change your ID (and OT if your didn't pick GF), then just catch Mew through a glitch.
- Use ingame glitches to change your ID, then use ingame glitches to obtain a gift Mew. This method is easily repeatable once you managed to set everything up.
Note that any Mew obtained this way is considered hacked by virtually any community. While technically, there is no way to tell it's not legit, there's a moral component to it. If you intend to use any Mew obtained this way in trades, you should disclose your method.