Unless the environment is also touched by a part of the program written in Go, Julia, I don't know... The lock is not shared across languages.
Which just to be clear: it cannot without changing the standard. There is really nothing anyone can do without a change in the standard.