That would be a custom function, be very difficult.
Ofcourse you could simply look for "from " (from plus space) and replace it with "from domain1_app1_"
but what if you want to select from two tables at once?
Technically you could build a function that parses your query, but it quite complex to do.