I don't think it's illegal. You are applying for two jobs, the one that comes through sooner, you'll take. Ask Service Canada. I remember somebody else who was doing this too. If they both come through, you can still only get a work permit for one of them though.