Clean up follow-ups from target entity decoupling review
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3586082. -->
Reported by: [kristen pol](https://www.drupal.org/user/8389)
>>>
**Problem/Motivation**
There was out-of-scope feedback on:
#3577428
<a href="https://www.drupal.org/files/issues/2026-04-21/target-entities-mr-3577428-review.pdf">Feedback (PDF)</a><br>
<a href="https://www.drupal.org/files/issues/2026-04-21/target-entities-mr-3577428-review.md">Feedback (MD)</a>
**Description:**
Follow up on the non-blocking items identified during the target entity / DER decoupling review. The MR made `dynamic_entity_reference` optional successfully, but a few cleanup tasks remain to reduce optional dependency coupling, improve documentation, and tighten safer render/input patterns.
**Tasks:**
- Remove the `DynamicEntityReferenceItem` import/reference from `AiContextItem::matchesTargetEntity()` and inspect target field item values generically.
- Document the trust boundary in `AiContextEntityTargetResolver::getCurrentEntity()`, especially for entity context read from POST/JSON request bodies.
- Replace manually escaped `#markup` scope summaries in `AiContextScopeManager` with safer render arrays or `inline_template`.
- Update README/docs to note that Target Entities require the optional `dynamic_entity_reference` module.
- Review whether `AiContextItem::getChildren()` / `hasChildren()` should delegate to `AiContextChildrenService` or be documented as convenience methods not intended for looped usage.
**Acceptance criteria:**
- `AiContextItem.php` no longer directly references DER classes.
- Target entity matching behavior remains unchanged.
- Scope summary output remains visually unchanged and XSS-safe.
- README/docs clearly describe the optional DER requirement.
- Any child lookup API decision is either implemented or documented.
- Relevant existing tests pass with and without DER where applicable.
**AI usage disclosures:**
- [x] AI Assisted Issue
- [ ] AI Generated Code
issue