Fixes automake bug https://bugs.gnu.org/53530.
Based on the cadence of Automake releases, add the current Python
release (3.10), the current Python development (3.11), and then 4
more versions on top of that. It doesn't hurt to check for a few
extra versions here since this is the fallback logic when the main
`python` and `python3` programs aren't found.
Resolves: rhbz#2210304