It was a tiny miss in partition count.
Topic A had actually 10 partitions and I was repartitioning the rekeyed topic B to 40 partitions by mistake (as I thought topic A had 40 partitions)!
Changing the partitions count to 10 in repartition operation fixed the issue and it worked as expected.
Sorry for the miss and stupid question.