jgetner wrote:might lead to the need of a parser and lexer
Well yes, it would: what you're doing is designing a new language based on PHP.
Even if it's more just a template language (on top of a template language!) - even if the additional syntax were merely sugar for making efficient-but-hairy standardised coding constructs legible and writable by humans. A preprocessor that desugars such a program so that it becomes ordinary PHP would have to know enough about PHP's own syntax that it doesn't mangle parts that it shouldn't.
And if the language changes are more extensive - automatic generation of new classes to implement types, say, or reparameterising function declarations and calls to take additional arguments for the framework's use - then there's more parsing involved, and also some code generation: it becomes simpler to parse the entire program, manipulate the AST, and serialise the resulting tree to code. Effectively it becomes a kind of compiler. And if you're writing a compiler you're no longer under an obligation for the source language to look like the target language.
I'm fairly sure that PCRE's regexps - given their support for backreferences, conditionals, and recursion - are sufficiently powerful to write a full parser ... but I doubt it would be very nice to look at or work on.