Maintain original file's container

Is it possible to create a profile that converts any file to .h264 but maintains the original file’s container?

The profile needs a specific extension so while you can’t make one profile, there are ready made profiles for each container type (mp4, mkv, ts, wtv, etc). You can make a separate conversion task for each file type (use filename filters in the conversion tasks) and associate it with the appropriate profile for that container.