rts: Drop .wasm suffix from .prof file names
This replicates the behavior on Windows, where Hi.exe
will produce
profiling output named Hi.prof
instead of Hi.exe.prof
.
While in the area I also fixed the extension-stripping logic, which
incorrectly rewrote Hi.exefoo
to Hi.foo
.
Closes #24515 (closed).