When a UIDocument is under a nested GameObject, the UI does not update with any changes to controls made through code. The same code works if its a root GameObject though.
Nevermind, I figured out this was related to if the parent object is disabled. Once it becomes enabled again the UI just seems to not update with the changes.
I was able to fix this for my use case by just not disabling the parent object anymore.