Indeed, you can’t install new things onto the ostree root. This is part of ostree’s design.
However the suggestion given above uses flatpak to create a sandbox where you have more freedom.
You can also use podman
or toolbox
on Endless to create and manage containers where you have full access (some notes here: Release | Endless OS 3.6.0).
These approaches are perhaps similar to the GNOME SDK sandbox that you have created, but they are done in a more organised and industry-standard fashion.