"Session" variables apply to the connection. (Usually, there is exactly one connection per client.) Two different clients (or different connections in one client) may have different values in the variables.
"Global" variables are defaults that are copied into "session" when you connect. Then you, or your client code, or the 3rd party application, or whatever, could change the variables.
Note: Some global variables are really global -- the "session" value always tracks the global copy.
If you display the session value from the same connection, then that is what the connection is using. If you make a separate connection to read the value, then what you see may not be what is in effect.
There are hundreds of 3rd party packages out there; who knows what each of them does. Furthermore, things change from version to version of that package.
sql_mode can be changed in a session.
In your example, something in the connection added
SQL_MODE. And it should be in effect for the connection until it is changed again.