There's one more tool to configure, the following should be used to switch to the right version:
cd /usr/src/php-$VERSION/ext/$EXTENSION
update-alternatives --set php /usr/bin/php7.4
update-alternatives --set phpize /usr/bin/phpize7.4
update-alternatives --set php-config /usr/bin/php-config7.4
make
Then use
make -n install
check the output to see if it now has all the correct directories here too. Then a
make install
will correctly configure the extension.