To stop a service A with a timer, you can create a service B of type oneshot
that it will be in conflict with, then use a timer to start the service B.
If a unit has a Conflicts= setting on another unit, starting the former will stop the latter and vice versa. (source)
A.service:
[Unit]
Conflicts=B.service
...
B.service:
[Unit]
Description=B service description
[Service]
Type=oneshot
ExecStart=/bin/echo ''
B.timer:
[Timer]
AccuracySec=1
OnActiveSec=10
[Install]
WantedBy=timers.target
The following will stop service A after 10 seconds.
systemctl start A.service
systemctl start B.timer