I’m not sure if this is the best approach, but it’s possible to get the topic creator username like this:
const controller = Discourse.__container__.lookup("controller:topic")
const username = constroller.get("model.details.created_by.username")
This doesn’t work directly in the <script/> tag, you’d probably want to use it on a api.onPageChange or some other event (in a quick test it also worked on a setTimeout with 0ms, but I don’t know if there are side effects).