Did you miss Re: Regexp Speed Concerns? I pointed there to two links
here where there is code for automatic optimization of
REs. The third link is to a general purpose optimization
which would need to be done within Perl's engine, but
which could lead to very good things.
As for why Perl doesn't do what lex does, the finite state
engine that lex produces is a DFA, and so unable to handle
backreferences or tell the difference between .* and .*?.