As long as you just want to know whether the shell is directly run within Dolphin's integrated terminal, it's simple: check the of the parent process.
if [[ $(ps -o comm= -p $PPID) == dolphin ]]; then …
The comm field is the executable's base name.
If you also want to detect nested shells (for example running zsh inside zsh, or :shell inside Vim), it's more complicated. You can check whether the output of pstree -p $$ -s contains dolphin, which will tell you whether Dolphin was involved at any level. This will report false positives, for example, if you start another terminal emulator from inside Dolphin.
Dolphin implements several terminal identification control sequences such as CSI > Ps p but the output is the same as in Konsole. CSI > Ps q is not supported, at least by default (and this is justified because it's a security risk since it can inject arbitrary content into the command line). So I don't think you can get the information that way.
Some GUI terminals set the WINDOWID environment variable to their window ID. Dolphin's integrated terminal sets WINDOWID to 0. This might be weird enough to be a useful indicator: terminal emulators generally either don't set WINDOWID at all or set it to an actual window ID (e.g. xterm and konsole do it). Note that WINDOWID carries the risk that it remains set when you start a terminal emulator from another terminal emulator, for example it can get carried into a screen or tmux session.
pstree. You could also look at parsing the output ofpsand follow thePPID(PID of the parent process) up the tree to see whether or not you wend your way to Dolphin befure you hit PID 1.echo "=== id ===";id;echo "=== set ===";set;echo "=== env ===";env | sort;echo "=== alias ===";aliasin each of your environments./proc/$$/PPID, readman proc, follow the chain of Parent's Parent's ... up, looking at/proc/*/exeas you go.