The problem is usually not with the camera at all. It is with the way the file system created on another device does not comply with what the camera requires for the card to properly work in the camera.
That's why the best practice is to format the card in the camera in which it will be used. After it is formatted, the camera will create a file system that is compliant with the Design rule for Camera File System (DCF) Standard. If the identical file system is created using a PC (from a "disc image" copied from an identical card that has been formatted by the camera), there should be no problems.¹
The problem is that some computers, usually those loaded with "crapware" by the manufacturer or seller in exchange for payment from software companies who wish pieces of their software to be pre-installed on computers sold at retail, add things to file systems that are not compliant with the DCF standard to SD cards inserted into the computer's reader.
Here's an example using the Canon EOS 6D to work around an issue one user had with his customized image file naming convention when he imported them to this PC that was posed by Canon changing the way image folder numbers are automatically named in newer EOS cameras (always reset to folder # "100" after a format) compared to the way they were automatically named in older EOS cameras (continuing with the last used folder number on the card just before it was formatted) after an in-camera format in Canon 6D resetting folders on card format - a way to stop this?:
Page 135 of the EOS 6D Instruction Manual explains how to create the needed folder structure and how to name folders. All folders with images must be created inside a folder named "DCIM". Basically each folder name must have 8 digits consisting of three numerical digits from 100 to 999 and five alphabetic (or _) digits. There can only be one folder that begins with any unique 3 digit number between 100 and 999, regardless of the five alphabetic characters that follow. You can have both a folder "100AAAAA" and "101AAAAA", but not both a folder "100AAAAA" and "100AAAAB".
One easy way to do this would be to erase all images on the card (which would leave your folder structure with customized folder names intact), copy the card's disc image to your computer, format the card in camera, then copy the disk image back onto the card with your PC.
¹ Based on your assumption there are not defective cards, damaged cameras, etc. involved.