How do you switch scopes from a title to the provinces held by that title?
I believe switching to location = {} does the trick.
Also, what exactly is included in the any_realm_province scope? Is it all provinces held by the character and his vassals, or does it include his liege's as well?
Character and vassals. Realm never looks "above" present scope/character. If you want the whole realm, you'd first need to scope switch to the top_liege = {}.