An Apple Store will never guarantee not to erase the drive as Apple assumes the user has backups. The tech at the Apple Store should have made this clear to you. Check the paperwork you signed and you will likely see a note about Apple not being responsible for the data.
An AASP may be more likely to honor your request about not erasing the drive if the AASP performs the repair at their own shop, but sometimes it just is not possible depending on the issue. Sometimes techs are so busy, that they may not see the note or they may even forget about it. People can become distracted so it is never wise to rely on others to keep your data safe.
If an Apple Store or an AASP mails the laptop to an Apple mail-in repair depot, then you have no guarantee that the data will be safe. An Apple mail-in repair depot assumes that they are allowed to erase the drive or replace the drive if necessary without attempting to backup the data.
Apple no longer takes responsibility for any user data and puts the responsibility on the user to maintain proper backups. The reason Apple does this is because Apple no longer asks for user's macOS user account passwords for security reasons. This means Apple cannot access your data to back it up even if they wanted to back up your data. This is to protect both you and Apple. Because Apple does not have your user account password, it means that no one working for Apple or contracted by Apple can access any of your personal files which could be used to compromise your other online accounts or to post incriminating or embarrassing documents or photos online. In fact, Apple trains their employees and AASPs not to ask for your password, but to have you unlock the account while they attempt to troubleshoot software issues with you present & watching over their shoulders so that you know that they are not accessing or copying your personal files. This is to avoid any possibility of a user accusing Apple or an AASP of accessing personal documents.
If your paperwork indeed shows a note explicitly saying "Do not erase -- preserve data", then check with a lawyer for your legal options. However, your data is long gone unless you have a backup, or you stored some files on some external media or the cloud. You have just learned a very painful lesson about backups.
You should always have frequent backups of your computer and all external media (including the cloud) which contains important & unique data. Keep in mind that it is impossible to recover accidentally deleted data from an SSD after the Trash has been emptied, plus there are ways to delete data so it never makes it to the Trash in the first place. Plus an SSD can fail at any time without any warning signs (even a brand new SSD). In addition, the SSD is integrated into the Logic Board of USB-C Macs which mean if the Logic Board is not functional, then there is usually no hope of data recovery. Even a macOS update can corrupt the T2 security chip or M1 firmware which can destroy access to your hardware encrypted data as there is no way to access the encrypted data. So you see, there are a lot of ways to lose data.
I'm sorry for your loss.