[fix] Apply on-the-fly class aliases, even for Composer packages. Fixes #5189, fixes #5179