When a stealth heist goes loud both the teammate AI and guards/SWAT start sprinting around at mach speed. Loud exclusive heists don't seem to have this issue, and during stealth guards move along their patrol routes at normal speeds.
PlayerDamage:is_friendly_fire() doesn't correctly determine if TeamAI is being shot by friendlies, resulting in TeamAI not taking damage from cops at all with Pro-Job disabled. Also, this function uses "friendly_fire" variable, but it's supposed to first declared with "local", otherwise "friendly_fire" is a global variable. This can be a reason why sometimes Player stops taking any damage too.
From my testing, making "friendly_fire" a local variable and removing elseif check at line 214 in playerdamage.lua, seems to fix player's invincibility. This, however, makes TeamAI to take friendly fire damage with Pro-Jobs disabled again.