Am I able to add line numbers to a code block despite the theme?

If you want to see line numbers, enable line numbers in the site configuration.

[markup.highlight]
linenos = true

https://gohugo.io/getting-started/configuration-markup/#highlight