This is all parser limitation, which cannot handle those two cases at the same time:

ListPages with [[code]] inside

[[code]] with ListPages inside

We decided the latter is more handy, so the first cannot be really achieved unless we somehow change the parser, which is kind of planned, but probably won't be done any soon (it's also needed for this bug).