using copy on write would be easier (and more performant), along with getenv_r. POSIX requires not to copy the data which makes the entire mutex/lock or CoW pointless. Of course, there will be the mandatory mentioning of "extern char *environ;"[0]. That returns are raw C strings as you can find them.
What could work is per thread env. changes - but that's not likely to happen
[0]: https://linux.die.net/man/3/environ