[RFR] Use hasChildren method to fix perf issues

See the PR in phpcr-api for more details