You cannot "solve" xpath injection. This is just the way Mendix works. But this shows that you cannot rely on xpath constraints on pages. Entity access should be configured at the database level (domain model). This way even with xpath injection users can't retrieve more data than they're allowed to see anyway. They will be able to circumvent constraints on the page, but that's not going to hurt security. If for example managers can see their employees somewhere in the application, but you made a page dedicated to showing employees who joined the organization less than a year ago, users will be able using xpath injection to show all their employees on that page, but not more than they're allowed to see according to entity access.
Martin has this spot on. When explaining this to full stack developers / security teams, you need to explain that you have your:
The security lies in the access rules. Intercepting the request and changing the browser call is fine.
It's like saying: