GrapheneOS has a network permission that is opt-out but available on installation.
That way you can make sure apps dont have internet.
But for only allowing certain domains you may want a firewall or even DNS block.
Dns is for the entire system afaik, but the work profile has its own network connection and thus can have an own VPN app with firewall functionality (controlling all network traffic, auto-start and block other connections)
While you cannot edit the hosts file, you can use a DNS like NextDNS that allows you to disable many domains by simply not resolving them.