Ok so I added the following and that seems to have done the trick, thanks for your help, Peter!
plesk bin domain --update-web-server-settings "${domain}"
For those searching, this is my full code:
# set base php version target, eg 8 for php 8.x
readonly target_php_version=8
# get the current...