Reverse proxy on the Pi? If a request comes in for the server and x minutes have elapsed since last activity/WoL, send a new WoL.
I'm a little out of my wheelhouse though. Maybe that would only work for HTTP which will not cover Time Machine?
Does Time Machine run on a schedule? Add a cron job (whatever the Mac equivalent is) to send a WoL ~1min beforehand?