It will be interesting to see what the issue is; and whether it could have been expressed in a reference such that you would have avoided it.
We're all targeting different MCUs with different compilers. You can minimize additional differences by putting code in its own module in the usual way: a separate .cpp with a corresponding .h that you can #include in the .ino to use it.
You can create a New Tab for each .cpp and .h, which will live in the sketch directory alongside the .ino. You can also have a subdirectory named src, and subdirectories with any name under that. The arduino-cli backend will recurse that to find all the source files, compile them, and let the linker figure it out. If you're using src, then in the IDE Settings, turn on "Show files inside Sketches" so the Sketchbook shows the file tree. The IDE also has no mechanism to create files in subdirectories; but that's not much of a hurdle, and it will pick up new files that appear.