There is no magic, macOS just checks which version of the SDK was used when compiling the app, if the SDK version is 26 or higher, it will make it go through the new UI path, if not it will get the previous UI.
I don't know how the Python bridge works, but it clearly needs to be updated or recompiled with the new SDK.
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: