You are correct that deleted iCloud emails only remain on Apple servers for 30 days. That allows recovery during that time while still protecting your privacy by not storing your data any longer and also not filling up your iCloud storage with emails you have already deleted.
Backups don't include emails, it is the email provider that stores your emails and when setting up a new device or resetting a device, the emails stored on their servers are downloaded to your device.
For other mail accounts, such as your work email, you can set how long you would like deleted emails to remain on their servers in the Mail Settings for that account, but the email provider can remove them before that time to comply with their privacy policy.
- Note: Some email services might override your selection; for example, iCloud doesn’t keep deleted messages longer than 30 days, even if you select Never.
Delete and recover emails in Mail on iPhone - Apple Support