Is there any possible way to achieve this kind of custom generation of html tags using expressions?
I can't answer that directly, it's something maybe TMSWhite could speak to, but...
You do not need a <script> tag for Expression Manager expressions. These expressions are parsed at the server before page rendering.