Hi Christopher --
The short answer is yes, you can programmatically create files in Canvas user or course file structure -- there's some documentation on the process here: Uploading Files - Canvas LMS REST API Documentation
In the second step of that process, you POST the file data to the URL that's provided by Canvas. When you make that POST request, you could dynamically create the contents of the file and include it in the request body. We do something like this to upload our user profile photos, which are stored in a database locally. We essentially read the image data from the database and POST it as the contents of a JPG file that we place in each user's file folder. This way we skip the step of actually creating a JPG file on disk locally.
I hope this helps -- let me know if you'd like any more detail!
--Colin