Ok it seems after some digging I have solved this puzzle. Definitely not the best way, but it will do.
In e.g. advent_carrier_capital_ship.unit we can replace the "ai" section content, from
"ai":
{
"attack_target_type_groups": [
"heavy_capital",
"defense"
],
"attack_target_type_groups_to_ignore": [
"torpedo_strikecraft"
],
"attack_target_type_groups_matching_weapon": "advent_carrier_capital_ship_beam",
"auto_follow_target_priority": 5.0,
"pursuit":
{
"min_distance_to_target": 5000.0
}
},
to
"ai":
{
"behaviors": [
"auto_attack_threats_no_move"
],
"attack_target_type_groups_to_ignore": [
"torpedo_strikecraft"]
},
The difference looks like that, the left is a new one:

I found this "auto_attack_threats_no_move" behavior in sins2.exe, no idea if any ship or structure currently uses it, but it works as described, carrier is using abilities, shooting all guns, automatically pointing to the target it is currently attacking with main weapons, and not going anywhere, even if I order to attack something out of range of all weapons and abilities. But fighters sure go. Simple move orders also work.
Another option is "auto_follow_unit_attacking_threat" behavior that Vasari Overseer uses. The difference seems is, with this behavior carrier will move if I directly command to attack something out of range, but otherwise hold position. But also will not automatically rotate to focus weapons on any target in range, only after direct attack command. So if main guns can't fire because of the angle, the ship will ignore that by default.
Not sure if any other behavior differences vs default game.
All carrier ships files in \Steam\steamapps\common\Sins2\entities\:
advent_carrier_capital_ship.unit
advent_carrier_cruiser.unit
trader_carrier_capital_ship.unit
trader_carrier_cruiser.unit
vasari_carrier_capital_ship.unit
vasari_carrier_cruiser.unit
No idea if works in multiplayer.
Feel free to use, create mods etc.