Does hostmaster email needs to be in same domain as defined in zone file?

No, it does not need to be in the same domain.

However, it is very common to use hostmaster.example.com, either matching the domain part of the name server or the preferred domain of the organization/company (e.g. example.net, example.com & icann.org all use the same SOA rname).

The recommendation in RFC 2142 Section 7 conflicts with using something like a gmail address:

For simplicity and regularity, it is strongly recommended that the
well known mailbox name HOSTMASTER always be used <HOSTMASTER@domain>.

The most important question however, remains whether even when your DNS is broken your hosting providers have reliable means of contacting you.

Caveat: Just because you publish your preferred methods of contact in whois, SOA, Impressum, security.txt etc. does not mean they will be used that way. I have received inquiries to [email protected] without ever publishing such address in the SOA record of domain.example, which is a good argument in favor of unconditionally setting up hostmaster as an alias.