Solved it simply by just doing:
res = subprocess.run(['git', 'diff', '--cached', '--name-only'], text=True, capture_output=True, check=True)
lines_to_update = res.stdout.strip().split('\n')
It does what I want but still very confused why pre-commit just do not support this out of the box already.