Can I upgrade to an SSD with the newest macOS from an old HDD with old macOS on MacBook Pro 2012? As per the title, my MBP 2012's hdd with Mavericks installed had recently failed and I am looking to replace it with an SSD.
I also have a MacBook Pro 2017 that I'm going to use to install macOS Catalina on the new SSD, so that I can directly use my MBP 2012 without having to wait for internet recovery.
Question is, can the MBP 2012 recognize the Catalina-installed SSD, even if I assume the firmware is for the old Mavericks? Or do I have to go through internet recovery?
Broadly speaking, any volume with MacOS on it should boot on any Mac that the OS supports.
There are some exceptions to that rule, of course. The newer T2-chip Macs complicate things with their SecureBoot settings. And some Macs require firmware updates on their internal drive before they can use APFS volumes -- though in your case the EFI partition will be created when you install the OS.
So it should work.
The better alternative would be to create an 'installer disk' on a small USB thumb drive, and boot to that, on the 2012 MBP, to install on the SSD once fitted internally.
https://support.apple.com/en-gb/HT201372