I don't think this can be done using Mod Rewrite but I will be VERY happy to be proven wrong, so want to throw this out for peer thought and review

Is it possible, via a mod_rewrite declaration (httpd.conf and/or .htaccess) for all URLs to be accessed and if they URLs refer to a server side language to be ,whether that be PHP, a CGI (of whatever flavour) or SSI etc., "run", then prior to sending the output to the browser the content will be passed to a script for further processing?
This is the complete backwards way to normally using mod_rewrite. Usually you will intercept a URI call and then do whatever you want with it, whereas I want the server to do what it normally does, but then send the output to my script to be further "worked upon"
So am I wrong? Can you do the above ?
.
.
.
.
As I am typing I have thought of one way it can be done (sort of) but it is bloody ugly
Pass all requests to my script as per normal mod rewrite, then grab the file that would "normally be requested" and parse it for tell tale server side language functions.
<? <?php <?php5
etc.
are all tell tail signs of a PHP script, meaning we know to run the code on the page via the PHP interpretor, prior to manipulating the output.
#!/usr/bin/perl
#!/usr/bin/python
etc.
Is a tell tail sign of a CGI script (using the shebang line to tell us the interpretor)
and
<!--#include virtual="header.html"-->
etc.
is an identifier of an SSI call
but compiling a list of every serverside language and how to test for each, and how to not fuck up existing mod_rewrite directives is really starting to screw with my lil head. Is it the only way or is there a more elegant way it can be managed ?
Thanks
Jason