That's like assuming that if you let a lion out of a cage it won't eat you. The genie is under no obligation to serve you. The wish granting is only to trick you into asking for something it can use to harm you, presumably with your permission to do so because you asked for it.