I'm not sure what you mean by "not reliable" - web content loading and layout are asynchronous processes, so it can happen that measuring at a random time can give incorrect results, especially if there are some images. It really depends on your content and the method you're using to measure size - there are many.
I would suggest finding a solution that injects a hook into JS and triggers some function on size change, which then notifies the Compose code. Anyway, technically it's a 3-way step, so it's hard to make the compose react to it immediately.
P.S. As far as I can remember, WKWebView has always been a bit weird. Sometimes it's necessary to create it with quite a huge size, like x2 of the screen size, to make it render all the content, then check the seize.