Is iMessage tied to an apple account or a phone number?

Usually iMessage is tied to the email associated with iCloud. If the person is using iMessage on their new number they would have logged in with their email address and hence receive the message.