The PL/SQL preprocessor does not parse preprocessor directives if they're located in a string, which can be demonstrated with the following simple procedure:
create or replace procedure tq84_cond_text authid definer as
begin
dbms_output.put_line(q'[
$if true $then
1
$else
0
$end
]');
end;
/