So, I was messing with "part" kickstart options for so long without any success, and I realized that many redhat options are not supported. And if you make just 1 simple mistake in 1 option then Ubuntu installer switches to Guided partitioning. Moreover it fails to do Guided partitioning in this case: it can't install grub on MBR partitions at the end of installation and can't proceed to installation cause it can't detect EFI boot partition that it proposed in Guided partitioning screen.
I used @Anderson Zardo answer but I had to add several lines to preseeding so partman won't prompt user to "Finish partitioning and write changes to disk" and also included some possible caveats.
Following kickstart partitioning configuration works on both EFI and MBR configurations, it detects everything automatically and even creates /swapfile with recommended size an activates it for installed system.
#System bootloader configuration
zerombr
bootloader --location=mbr
clearpart --all --initlabel
# preseeding partman partition information
preseed --owner d-i partman-auto/method string regular
preseed --owner d-i partman-auto/expert_recipe 'string gpt-boot-root :: 256 256 256 fat32 $primary{ $iflabel{ gpt } $iflabel{ gpt } $reusemethod{ } method{ efi } format{ } mountpoint{ /boot/efi } . 512 512 512 ext4 $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ /boot } . 4000 10000 -1 ext4 $primary{ } method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ / } .'
# preseeding partman additional options for automation
preseed --owner d-i partman-auto/choose_recipe select gpt-boot-root
preseed --owner d-i partman-basicfilesystems/no_swap boolean false
preseed --owner d-i partman/choose_partition select finish
preseed --owner d-i partman-md/confirm boolean true
preseed --owner d-i partman-partitioning/confirm_write_new_label boolean true
preseed --owner d-i partman-lvm/confirm_nooverwrite boolean true
As a result EFI system is partitioned to GPT
# fdisk -l
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: EE83EBC4-881D-4157-A627-AC46A14AE694
Device Start End Sectors Size Type
/dev/sda1 2048 499711 497664 243M EFI System
/dev/sda2 499712 1499135 999424 488M Linux filesystem
/dev/sda3 1499136 20969471 19470336 9.3G Linux filesystem
# swapon -s
Filename Type Size Used Priority
/swapfile file 448816 0 -2
Non-EFI system partitioned to MBR
# fdisk -l
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xaf7c9c63
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 999424 20969471 19970048 9.5G 83 Linux
# swapon -s
Filename Type Size Used Priority
/swapfile file 460496 0 -2
And I noticed that it installs grub during EFI install. I don't know why that's needed but it seems that grub is just not used and everything works fine. Hope I saved much time for anybody.