Could docker-php-ext-configure throw an error in such cases?
docker-library/wordpress#454 (comment)
Open discussion that it might be useful to do exactly that. I think passing --enable-option-checking=fatal to ./configure should do the trick.
We make break some users where it is currently just a warning. Their flag is wrong, so it does seem reasonable. Alternatively we only enable this for 7.4 and above, since that is when flags change appreciably (#910 (comment)).