Using get_target_property (or just get_property) with generator expressions

Your are right for the example, you have to switch to upper=case first:

if (CMAKE_BUILD_TYPE)
  string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
  get_target_property(PY_LIB_ADDRESS python IMPORTED_LOCATION_${UPPER_BUILD_TYPE})
else()
  get_target_property(PY_LIB_ADDRESS python IMPORTED_LOCATION)
endif()

But your interpretation of behavior of get_filename_component() is erroneous. If you look at PDB_PATH contents, you will see that generator expressions are not evaluated. The evaluation occurred during generation when property COMPILE_PDB_OUTPUT_DIRECTORY is evaluated.

Again, I repeat, generator expressions cannot be used during configuration step because they are evaluated during generation step.