wikipedia https://en.wikipedia.org/wiki/Halting_problem
The proof then shows, for any program f that might determine whether programs halt, that a "pathological" program g, called with some input, can pass its own source and its input to f and then specifically do the opposite of what f predicts g will do.
This means g() needs to have complete access to f(). The situation is indeed similar to the dissociation problem. We could for example assume that f() passes its source to g(), or we could debate this, or consider it a specific pathological example. f() can solve the sitution if it pathologically does not halt only when it happens, preventing g() from halting, by moving the situation of undecidability from the external system to the internal system, but if the input data is the same this could break pure functionality. Sounds fun to think about! ok there’s a small space where it might be possible if f() can take the entire execution system state as input: i.e. the state of the turing machine. then it can determine whether it is the inner or outer simulation, or in more complex scenarios otherwise engage in meta-analysis of the shared system.