You nailed it, down to how you'd do it without any help from Cupertino: https://github.com/saagarjha/Ensemble
Try it with a full suite of Mac Apps and you’ll find it falls apart because they aren’t all well behaved.
You are making this sound much more complicated than it really is.
The trivial case is simple. You are imagining it's all the trivial case.