On Android 8 and later location is needed for certain actions in tasker.
For example profile with state WiFi Near cannot be run if location is set to off on device.
Tasker can change location setting between off/device only/battery saving/high accuracy.
As far as I know there really is no way (since profiles cannot be run manually) to create task that enables location for that brief moment some profile requiring it to work needs it.
Suggestion:
Add option to profile preferences to set desired location mode for profiles that need location to be enabled. This way the profile itself would