Doug,
I rebuilt my 2GM raw water cooled engine. I was not burning oil so did not replace rings or bearings. The water passages were plugged. This was a winter project done in my basement and cost about $400. If you have any mechanical ability, or have friends that do, it is much cheaper to rebuild. Look at the link in my signature for Rhapsody projects and download the presentation on engine rebuild.
Low compression could be valve wear. You could do a valve job. All parts are readily available from authorized Yanmar suppliers. The
Yanmar Service Manual is available on our class website, although I bought the manual from the dealer. It is very good.
Bottom line - if you do change it out, the 2YM should fit in the space. I don't know if the KM2A transmission bolts up, but suspect it does. Check with the Yanmar dealer.