fix(client): don't try to run non-native engines before copying
Don't try to run non-native engines querying them for version when
determining whether they should be overwritten during generation.
This PR takes a rather conservative approach to fix the issue by
adding a check to compare the binary target of each engine with the
current platform. This only fixes the bug without changing the
performance characteristics of the code in any way (`getPlatform` is
memoized so calling it is essentially free at this point).
However, we should benchmark and re-evaluate if these checks provide
any benefit compared to just always copying and overwriting the
engines upon generation. When using the library engine, the version
check also leads to increased memory usage, as unlike with the binary
engine, all of the successfully loaded libraries (usually two when
regenerating existing client, but potentially even more on Linux since
there may be multiple binary targets compatible with the current
system) will stay loaded in memory until the generator process
exits. This also runs the napi-rs initialization code for each of
them, and we don't use Query Engine for anything else anymore in the
generator, so this is the only time QE is currently loaded during
generation.
Fixes: https://github.com/prisma/prisma/issues/4308