These script could not make on your html java script snippet. The only way is to append the script into body section, however the javascript action is in async mode, and async mode can only modify the script tag on head tag not in body tag.
Therefore the last choice is wrap the cesiumjs into react component and build a pluggable widget.
Take the custom widget route :)
1. Make a new Pluggable Web widget
2. check the react library for this library
3. As per the library requirement just drop in the JSX components in the widget code and you should be good to go as a first draft.
Based on your requirements you can tweak the options.