Does bitcoin.conf expand environment variables?
No, bitcoin core does not expand environment variables in bitcoin.conf.

See here to see how options are parsed.

You can expand environment variables as arguments for bitcoind:



$ bitcoind -rpcuser="$RPC_USERNAME" -rpcpassword="$RPC_PASSWORD"