Technically, yeah.
In Europe we
finally started to test fully-automatic couplings[0] for freight trains last year (as in, run a production train on the system, making sure to collaborate with freight customers that won't complain).
These couplings are a massive upgrade over the common hook&chain freight coupling, which requires substantial manual labor for (un-)hooking. The new ones theoretically allow for fully automatic freight shunting/train re-assembly.
Now we "just" need to up the speed limit for freight trains to at least the 140/160 km/h most commuter rail uses for max cruise speed, and retrofit the digital part as needed to the already-used mechanical coupling to some electric multiple units that operate on congested links with demand for intra-day freight.
A few (1-4) box/container/"swap body (truck/rail only deriviates of ISO 20ft containers)" cars should typically be no problem for these EMUs (especially the longer ones), and would allow to realistically compete with trucks on interstates (Autobahn). Just needs some very small shunting engines, probably ideally remote-controlled (from the rail yard's tower), to add/remove freight cars from the tail while the passenger doors are open. Timings is tight, but some automation for fairly aggressive acceleration/deceleration profiles during that shunting should suffice. Maybe later even add a low tier electric car's drive train hardware-wise to some such container carrier wagons, to let them do the shunting and possibly last-mile trip simply on battery power, as that'd greatly speed up the shunting (low speed acceleration is friction limited, and a separate locomotive can't use the freight weight on the freight axles for traction. They're only outfitted with brakes on typical freight cars.)
For example, these "swap bodies" which are like ISO containers with fold-out legs, should IIUC be able to get put on their legs coming from a freight car (just by folding them out and maybe using some small lifting jack style hydraulics to get an inch or two clearance), followed by that freight car (if it has a battery pack and some small motors) driving away under remote control, and the truck trailer driving under it. This would only need a switch and non-electrified streetcar-style concrete pavement integrated track long enough for one or multiple of these, on the side of an existing railway station. Some $50-100k plus whatever the concrete truck yard pavement itself costs. Adding the battery drive system thing should probably be around $20-30k on top of what the freight car (with the digital automatic coupling) would cost normally, at least if it's only manually operated with sight contact. (It'd recharge via the train's electric heating bus that was originally designed to replace the steam heating for passenger carriages. The coupling that was/is used with hook&chain is 600A@1000V 16.7 Hz AC (in Germany), with one coupling either side of the coupling. This should leave ample recharging power for a small battery pack on the attached freight.)
This obviously only works where trains and existing road infrastructure are level, but on cursory inspection, many train stations here in Germany already have that. On many commuter links there's hourly or even twice-hourly service here, so even fairly short trips could realistically make use of this shifting of traffic from street to rail.
[0]: https://www.dac4.eu/en/