You don’t strictly need wp_register_script()
but it is considered a best practice to use it as it allows other developers to programmatically work with the order and list of scripts being included.
Regarding your issue, your code looks correct. Be sure to call it inside the wp_enqueue_scripts
action (but I don’t think that’s influencing the behavior you are seeing).
If I had to guess, and I kind of do, I would guess that there is some other plugin or system configuration that is stripping the query string as part of a caching mechanism. The thought is that query string parameters, if they are present, can keep some proxy servers, and possibly browsers, from caching the resource. There are even some plugins such as Ratify and possibly W3 Total Cache that will strip query string parameters from resources for you, intentionally. The way to test if another plugin is interfering is by disabling them and seeing if anything changes.
If you are using a caching server or CDN, they may also be stripping the query string (but seems unlikely). Cloudflare offers a maintenance mode that allows you to briefly disable the CDN while you test things.
HTH and please let me know how you get on.