Allright found the issue and how to resolve it. But this is a very hacky way of doing it. This requires that for all the applications which have this problem, i.e. the default Wayland icon is displayed, this has to be done. There is already a bug reported about this in KDE version 5.25.3 and which was supposed to have been fixed in KDE version 6.3. But apparently it has not been fixed. I am on ver 6.3.3 but it is still not working.
To solve the issues follow the steps given in the comment number 35. In step number 8 change the file name to the actual desktop file name being used. To find the actual desktop file name of the application one of the following options can be used
Go to Octopi, which is a GUI frontend for pacman, and select the package. Once the package is installed click on the Files tab in the bottom and look for the .desktop file. That is the file name that you have to give in step number 8
OR
Typically the .desktop files are kept in the directory /usr/share/applications. Look in that directory for the file name.
Remember to give the exact filename with the .desktop extension and not the full path of the filename. Just the exact file name. Also dont forget the .desktop file extension.
I am not able to determine why this happened though. Is it because this is a GTK3 application? Or is it due to some other reason. When I looked in the kwin debug console I found that the application zim was listed under “Wayland Windows” and not under “X11 Windows” or under “X11 Unmanaged Windows”. So ZIM application is not using XWayland. So XWayland cannot be an issue over here.