It took me about 4 hours. It is a single-line command, but I felt the need to write this so that those who will spend time in the future can save those 4 hours for themselves. It involves custom software working with subdomains;
For a script that generates a specific subdomain for each category, such as a.sitem.com, b.sitem.com, and operates with wildcards, the issue can be resolved by running the following 2 commands after transferring to a newly set up Directadmin and Openlitespeed server.
cd /usr/local/directadmin/custombuild/
./build rewrite_confs
The first command starting with cd switches to the relevant directory.
The other command runs the build located in that directory and rewrites the rewrite files. It likely rewrites the site-specific configs in Openlitespeed, and the issue is resolved.