Webfinger technically supports that sort of delegation today in its spec: you can drop a /.well-known/webfinger JSON file on the domain's web server (or a cgi-bin app of some sort if you need to support more than one user because the protocol uses GET request parameters to differentiate) and tell ActivityPub servers "if you are looking for user anexample@thisdomain.com please forward to the inbox or check the outbox for anexample@mastodon.social". That works today for things like @ mentions or DMs of an account sending the right notifications. Unfortunately, this isn't yet the best experience because in many places including follows/follow requests Mastodon users will always see the forwarded address everywhere "anexample@mastodon.social" instead of the delegating address and so far as I'm aware there's no easy way to send messages addressed as the delegating address.
Somewhat related: there should be a way to have a Mastodon ID based on a domain you control, regardless of what instance it's hosted on.