Try right-clicking or Control-clicking on the folder in the Trash to see if you have the option "Put Back". If it was from a system area, then it may not be possible with all the new security features.
What was the original location of this cache folder?
FYI, I think you have learned a valuable lesson of not believing everything you read online. Most cache folders will be properly managed either by the OS or by the app placing items there. It should be rare that you would ever need to manually delete items in a cache folder by using the Finder interface. Some apps, like web browsers, may provide an option within the app itself to clear the cache. As for any other cache items, many times a reboot may do the job, or you can try booting into Safe Mode which will delete some temp & cache items safely.
Otherwise, don't delete anything you did not purposely place onto your computer. If you are trying to troubleshoot a problem, then maybe there may be a time to try to delete a cache, but you should never delete the main folder itself. A cache for a specific app may be an exception if the app is poorly written, in which case you probably should not be using the app.
Also, avoid using any cleaning or optimizer apps which advertise being able to clean your system. These types of apps usually cause more problems than they solve. The OS will generally manage things on its own.
If you cannot use the "Put Back" option, then you will most likely need to reinstall macOS over top of itself in order to fix the problem. If it was only a cache folder for a particular app, then maybe reinstalling that app may recreate the folder for you.
Before you do anything, make sure you have a good backup.
Maybe someone else will confirm my suggestions or provide a better option.