I have a workaround for the issue of Secure Boot disabling Trim on external drives. I'm posting it in case it helps someone else. In order to have Trim enabled on external SSD's when running with Secure Boot enabled, the SSD's need to be unmounted when starting up the computer. When the SSD's are subsequently mounted, Trim will be enabled.
I discovered this after reading about a similar issue with Secure Boot and SoftRAID drivers (which, for clarity, I do not have installed.) In that case, SoftRAID volumes need to be mounted after booting up (when Secure Boot is enabled), in order for the latest drivers to be used. SoftRAID explained that if macOS detects SoftRAID volumes at boot time, it will load the default SoftRAID drivers included with macOS, i.e. those "approved" by Secure Boot, which are not the most current drivers. By mounting SoftRAID volumes after booting up, macOS loads drivers at that time, using the most current versions installed on the computer.
I thought a similar approach might be used for Trim. It seems likely that whatever Trim-related ktext is loaded at Secure Boot is not the one effected by the Trimforce command, but that by having no SSD's mounted at boot time, the needed ktext is not loaded until the SSD mounts after boot and, in that case, macOS loads the one effected by Trimforce.