I've had ChatGPT generate code that imported a fake Go library, and proceeded to use it and its made up functions for it, so this seems like less of a stretch.
Just ask ChatGPT to create that fake library for you, it will at least give it a go.
I was quite wowed when it recreated python-vlc in ruby.
I mean, that's literally how software development works. Its not like your human first draft compiles on the first run either.
It's not perfect, you can't expect it to always be correct, factual and logic. But it gives you something to with. The companies that are rolling out LLMs need to fix these flaws, though. That's where the competition is moving to.